PHP code example of ilexn / custom-response
1. Go to this page and download the library: Download ilexn/custom-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/ */
ilexn / custom-response example snippets
php
/** var ResponseFactoryInterface $psr17ResponseFactory **/
$factory = new \Ilex\CustomResponse\CustomResponseFactory($psr17ResponseFactory);
$response = $factory->createJsonResponseFromArray(['data']);
$url = 'http://www.example.com';
$response = $factory->createRedirectResponseFromString($url);
/** var UriInterface $uri **/
$response = $factory->createRedirectResponseFromUri($uri);
$response = $factory->createEmptyResponse();