1. Go to this page and download the library: Download yiisoft/data-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/ */
use Yiisoft\DataResponse\Middleware\FormatDataResponse;
use Yiisoft\DataResponse\Formatter\JsonDataResponseFormatter;
$middleware = (new FormatDataResponse(new JsonDataResponseFormatter()));
//$middleware->process($request, $handler);
use Yiisoft\DataResponse\Formatter\HtmlDataResponseFormatter;
use Yiisoft\DataResponse\Formatter\XmlDataResponseFormatter;
use Yiisoft\DataResponse\Formatter\JsonDataResponseFormatter;
use Yiisoft\DataResponse\Middleware\ContentNegotiator;
$middleware = new ContentNegotiator([
'text/html' => new HtmlDataResponseFormatter(),
'application/xml' => new XmlDataResponseFormatter(),
'application/json' => new JsonDataResponseFormatter(),
]);
$middleware->withContentFormatters([
'application/xml' => new XmlDataResponseFormatter(),
'application/json' => new JsonDataResponseFormatter(),
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.