marcusirgens / jsend-factory
JSend factories for PSR-7
v1.0.0
2020-09-24 19:26 UTC
Requires
- php: ^7.3
- ext-json: *
- psr/http-factory: ^1.0
- psr/http-message: ^1.0
Requires (Dev)
- dealerdirect/phpcodesniffer-composer-installer: ^0.7.0
- guzzlehttp/psr7: ^1.6
- http-interop/http-factory-guzzle: ^1.0
- nyholm/psr7: ^1.3
- phpunit/phpunit: ^9.3
- slevomat/coding-standard: ^6.4
- slim/psr7: ^1.2
- squizlabs/php_codesniffer: ^3.5
- vimeo/psalm: ^3.16
This package is auto-updated.
Last update: 2024-10-25 19:13:17 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.