https://github.com/marcusirgens/jsend-factory
JSendFactory is a PHP library for creating JSend-compliant PSR-7 requests.
https://github.com/marcusirgens/jsend-factory
psr-7
Last synced: 6 months ago
JSON representation
JSendFactory is a PHP library for creating JSend-compliant PSR-7 requests.
- Host: GitHub
- URL: https://github.com/marcusirgens/jsend-factory
- Owner: marcusirgens
- License: mit
- Created: 2020-09-24T11:42:41.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2020-09-25T09:21:44.000Z (almost 6 years ago)
- Last Synced: 2025-10-12T00:44:20.058Z (9 months ago)
- Topics: psr-7
- Language: PHP
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# JSendFactory
JSendFactory is a PHP library for creating [JSend-compliant] [PSR-7] requests.
## Installation
Use the package manager [composer](https://getcomposer.org/download/) to install
the package.
```bash
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](https://packagist.org/providers/psr/http-factory-implementation).
If you're unsure, go for [nyholm/psr7].
## Usage
```php
$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](https://choosealicense.com/licenses/mit/)
[JSend-compliant]: https://github.com/omniti-labs/jsend
[PSR-7]: https://www.php-fig.org/psr/psr-7/
[PSR-17]: https://www.php-fig.org/psr/psr-17/
[nyholm/psr7]: https://github.com/Nyholm/psr7