Jump to content

New Rest Helper for Processwire


Recommended Posts

Hello folks

I have updated the code in my rest helper.

Since It was created nearly 2 years ago! 

Now its much easier to create rest endpoints in Processwire

You can download the code here.


This is and example simple login code.

$response = new Response();

$params = Request::params();

if (!Request::isPost()) {


} else {

	$username = $params['username'];
	$password = $params['password'];

	if ((!isset($username) || $username == '') ||
		(!isset($password) || $password == '')) {


	} else  {

		if ($username == 'hello' && $password == 'world') {

				$response->output['data']['name'] = 'Tony';
				$response->output['data']['lastname'] = 'Stark';
				$response->output['data']['job'] = 'Ironman';

		} else {


Will render something similar to

  "data": {
    "name": "Tony",
    "lastname": "Stark",
    "job": "Ironman"

Any questions or comments are welcome :D

  • Like 9
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...