konductors / hal-formatter
Small package to format the returned values based on the HAL specifications
Requires
- php: >=7.1
- illuminate/support: ^5.5|5.6.*
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.3
- orchestra/database: ^3.5|^3.6
- orchestra/testbench: ^3.5|^3.6
- phpmd/phpmd: ^2.6
- phpunit/phpunit: ~6.0|~7.0
- squizlabs/php_codesniffer: ^3.0
README
This package will help you return your API response as specified in the HAL Specification, with simple functionality.
Note: This may not be the perfect solution, but we will have to work on it to enhance it as we work.
Installation
- Then add it to your require section either using composer require
composer require "konductors/hal-formatter:~1.0" --prefer-source
or manually by editing your composer.json
file like:
{
"require":{
"konductors/hal-formatter":"~1.0"
}
}
for sure your require section will have more packages not just this one, so remember to add it.
Usage
You can use the Hal
like:
return response()->json(Hal::serviceName('post')->get());
Which will return the minimum response, or if you like to use the hal()
helper function which will return the same
return response()->json(hal('post')->get());
Check the docs folder for all the information about how to use it with Laravel Eloquent.
Changelog
Check CHANGELOG for the changelog
Testing
Contributing
Information will follow soon
Security
If you discover any security related issues, please email developer@klassapp.com or use the issue tracker of Bitbuket.
License
The MIT License (MIT). Please see License File for more information.