1. Go to this page and download the library: Download prsolucoes/web-response library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
prsolucoes / web-response example snippets
$response = new WebRespone();
$response->setSuccess(true);
$response->setMessage('redirect');
$response->addData('url-to-redirect', 'http://www.prsolucoes.com');
echo($response);
$response = new WebRespone();
$response->setSuccess(false);
$response->setMessage('validate');
$response->addError('nome', 'O nome não pode ser vazio');
$response->addError('email', 'O email informado é inválido');
echo($response);
$response = new WebRespone();
$response->setSuccess(false);
$response->setMessage('login-error');
echo($response);
$response = new WebRespone();
$response->setSuccess(true);
$response->setMessage('redirect');
$response->addData('url-to-redirect', 'http://www.prsolucoes.com');
echo($response);
$response = new WebRespone();
$response->setSuccess(false);
$response->setMessage('validate');
$response->addError('name', 'The name cannot be empty');
$response->addError('email', 'The email is invalid');
echo($response);
$response = new WebRespone();
$response->setSuccess(false);
$response->setMessage('login-error');
echo($response);