https://github.com/jderstd/psr
A response builder for PSR
https://github.com/jderstd/psr
builder jder json php psr response
Last synced: 5 months ago
JSON representation
A response builder for PSR
- Host: GitHub
- URL: https://github.com/jderstd/psr
- Owner: jderstd
- License: mit
- Created: 2025-12-13T14:33:38.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-12-23T08:55:44.000Z (6 months ago)
- Last Synced: 2025-12-23T21:55:28.822Z (6 months ago)
- Topics: builder, jder, json, php, psr, response
- Language: PHP
- Homepage: https://github.com/jderstd/psr/blob/main/docs/README.md
- Size: 120 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# JDER PSR
A response builder for PSR.
This package includes different response builders based on the JSON response structure specified in [JSON Data Errors Response (JDER)](https://github.com/jderstd/spec). With the builders, various kinds of responses can be created easily instead of sending plain text responses.
## Installation
Install this package as a dependency in the project:
```sh
composer require jder/psr
```
## Quick Start
To create a JSON response, use the following code:
```php
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use Jder\Psr\Json\CreateJsonResponse;
function route(
Request $request,
Response $response,
): Response {
return CreateJsonResponse::success($response)->create();
}
```
And the response will be shown as below:
```json
{
"success": true,
"data": null,
"errors": []
}
```
## Documentation
For the documentation,please refer to the
[documentation](https://github.com/jderstd/psr/blob/main/docs/README.md).
## Contributing
For contributing, please refer to the
[contributing guide](https://github.com/jderstd/psr/blob/main/CONTRIBUTING.md).
## License
This project is licensed under the terms of the MIT license.