Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

iLexN/CustomResponse

Repository files navigation

CustomResponse

Coverage Status Build Status Scrutinizer Code Quality

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();

About

Use any PSR 17 Factory to create custom PSR 7 Response helper.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages