marcusirgens/jsend-factory

JSend factories for PSR-7

v1.0.0 2020-09-24 19:26 UTC

This package is auto-updated.

Last update: 2024-11-25 19:26:29 UTC


README

JSendFactory is a PHP library for creating JSend-compliant PSR-7 requests.

Installation

Use the package manager composer to install the package.

composer require marcusirgens/jsend-factory

You will also need some PSR-17 implementation. You can find a list of packages providing this at packagist.org. If you're unsure, go for nyholm/psr7.

Usage

$responseFactory = new Psr17ResponseFactory();
$streamFactory  = new Psr17StreamFactory();

$jsendFactory = \MarcusIrgens\JSendFactory\JSendFactory(
    $responseFactory,
    $streamFactory
);

$successResponse = $jsendFactory->getSuccess(["message" => "hello"]);

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT