Download the PHP package guanguans/laravel-api-response without Composer
On this page you can find all versions of the php package guanguans/laravel-api-response. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download guanguans/laravel-api-response
More information about guanguans/laravel-api-response
Files in guanguans/laravel-api-response
Download guanguans/laravel-api-response
More information about guanguans/laravel-api-response
Files in guanguans/laravel-api-response
Vendor guanguans
Package laravel-api-response
Short Description Normalize and standardize Laravel API response data structures. - 规范化和标准化 Laravel API 响应数据结构。
License MIT
Homepage https://github.com/guanguans/laravel-api-response
Package laravel-api-response
Short Description Normalize and standardize Laravel API response data structures. - 规范化和标准化 Laravel API 响应数据结构。
License MIT
Homepage https://github.com/guanguans/laravel-api-response
Please rate this library. Is it a good library?
Informations about the package laravel-api-response
laravel-api-response
Normalize and standardize Laravel API response data structures. - 规范化和标准化 Laravel API 响应数据结构。
Features
- Support for customized response data structure
- Support for restful API response(optional)
- Support for automatically handled api exception
- Support for localized message
- Support for customized pipe(Process api response structure through pipeline)
- Support for customized exception pipe(Convert exception to api response through pipeline)
Requirement
- PHP >= 7.4
Installation
Configuration
Publish files(optional)
Usage
Quick start
details
json * { * "status": false, * "code": 500, * "message": "This is a runtime exception.", * "data": {}, * "error": { * "message": "This is a runtime exception.", * "exception": "RuntimeException", * ... * "trace": [ * ... * ] * } * } *Default response structure
details
Default response examples
model
eloquent collection
simple paginate
resource
resource collection
error
exception
debug exception
exception handler
locale exception
more examples...
* [feature](tests/Feature) * [examples](tests/__snapshots__)FAQ
How to customize pipe
* Reference to the [Pipes](src/Pipes) * Simple example:How to customize exception pipe
* Reference to the [ExceptionPipes](src/ExceptionPipes)How to customize pipe in a single api
* Reference to the [HasPipes.php](src/Concerns/HasPipes.php)、[HasExceptionPipes.php](src/Concerns/HasExceptionPipes.php) * Simple example:How to always respond with successful http status code
* Reference to the [StatusCodePipe.php](src/Pipes/StatusCodePipe.php) * Remove the configuration `api-response.pipes.StatusCodePipe`How to localize message
* Reference to the [MessagePipe.php](src/Pipes/MessagePipe.php) * Install [Laravel-Lang/http-statuses](https://github.com/Laravel-Lang/http-statuses) `composer require --dev laravel-lang/http-statuses` or create lang files `resources/lang/***/http-statuses.php`Shortcut methods of http status
* Reference to the [ConcreteHttpStatus.php](src/Concerns/ConcreteHttpStatus.php)Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- guanguans
- All Contributors
Thanks
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-api-response with dependencies
PHP Build Version
Package Version
Requires
php Version
>=7.4
ext-json Version *
laravel/framework Version ^8.83 || ^9.0 || ^10.0 || ^11.0
spatie/laravel-package-tools Version ^1.12
ext-json Version *
laravel/framework Version ^8.83 || ^9.0 || ^10.0 || ^11.0
spatie/laravel-package-tools Version ^1.12
The package guanguans/laravel-api-response contains the following files
Loading the files please wait ....