Download the PHP package arinasystems/laravel-json-response without Composer
On this page you can find all versions of the php package arinasystems/laravel-json-response. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download arinasystems/laravel-json-response
More information about arinasystems/laravel-json-response
Files in arinasystems/laravel-json-response
Package laravel-json-response
Short Description Easily generate a JSON response in laravel.
License MIT
Homepage https://github.com/arinasystems/laravel-json-response
Informations about the package laravel-json-response
Laravel JSON Response
Extensible and powerful API response package for Laravel.
- Localized Response
- Presets Response Status
- Attribute Builders
- Data Transformers
- JSON Exception Handler
- Installation
- Basic Usage
- Configuration
- Response Structure
- Preset Status
- Data Transformers
- JSON Encoding Options
- Debugging Mode
- Message Translations
Installation
You can install the package via composer:
The package will automatically register its service provider.
You can optionally publish the config file with:
Basic Usage
With just one line of code, your API client will get this response:
Configuration
You can customize the response configuration from config/json-response.php
file.
Response Structure
The first section in the configuration file allows you to set up the normal response and error response attributes. Each attribute array contains four options:
- builder: Used to build the attribute value. (builder class or null to disable)
- value: It's a default value if not passed in. (mixed)
- on-response: Determines whether this attribute will appear in normal response. (boolean)
- on-error: Determines whether this attribute will appear in error response. (boolean)
Preset Status
In transformers array define the preset statuses in the "Status" array. The key defines the status name, and the value is the name of the case class.
Data Transformers
Specify the data transformer for the given object type as a key and the transformer class as the value.
JSON Encoding Options
Set the json encoding options in 'encoding_options'.
Debugging Mode
Enable/Disable the debugging mode in 'debug' option.
Message Translations
Enable/Disable the locale response message in 'message_translations' option.
Testing
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.