1. Go to this page and download the library: Download juliangut/body-parser 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/ */
juliangut / body-parser example snippets
use Jgut\BodyParser\Decoder\Json;
use Jgut\BodyParser\Decoder\Urlencoded;
use Jgut\BodyParser\Parser;
use Negotiator\Negtiator;
$bodyParser = new Parser(new Negotiator());
$bodyParser->addDecoder(new Urlencoded()); // Assigned to all requests
$bodyParser->addDecoder(new Json(), ['POST', 'PUT']); // Assigned only to POST and PUT requests
$app = new \YourMiddlewareAwareApplication();
$app->addMiddleware($bodyParser);
$app->run();
$decoder = new \Jgut\BodyParser\Decoder\UrlEncoded();