PHP code example of avalanche-development / peel
1. Go to this page and download the library: Download avalanche-development/peel 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/ */
avalanche-development / peel example snippets
function someMiddleware($request, $response, $next) {
$body = (string) $request->getBody();
$body = json_decode($value);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new AvalancheDevelopment\Peel\HttpError\BadRequest('Invalid JSON');
}
// etc
}