ilexn / custom-response
This package is abandoned and no longer maintained.
No replacement package was suggested.
use PSR 17 Factory to create custom response helper
Fund package maintenance!
iLexN
0.1.0
2019-02-22 05:59 UTC
Requires
- php: ^7.2
- ext-json: *
- psr/http-message: ^1.0
Requires (Dev)
- ext-json: *
- nyholm/psr7: ^1.1
- phpstan/phpstan: ^0.11.0
- phpstan/phpstan-phpunit: ^0.11.0
- phpstan/phpstan-strict-rules: ^0.11.0
- phpunit/phpunit: ^8.0
- symplify/easy-coding-standard: ^5.4
- zendframework/zend-diactoros: ^2.1
This package is auto-updated.
Last update: 2023-12-09 07:01:07 UTC
README
Use any PSR 17 Factory to create PSR 7 Response.
Easy to create Json Response, Redirect Response.
Install
Via Composer
$ composer require ilexn/custom-response
Usage
/** 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();