Download the PHP package neography7/easy-response without Composer
On this page you can find all versions of the php package neography7/easy-response. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download neography7/easy-response
More information about neography7/easy-response
Files in neography7/easy-response
Package easy-response
Short Description Standardized response for REST APIs with easy usability.
License MIT
Homepage https://github.com/neography7/easy-response
Informations about the package easy-response
Introduction
Easy Response allows you to create REST Callbacks in an easy way. This package has 3 ways to create callbacks which you can use what you want. But if it's suitable for you, the helpers will be more easy and clean.
This package follows PSR-2 and PSR-4 standards.
Installation
You can install the package via composer:
Usage
There are three ways to use this package but using it with the helpers is recommended.
1) Helpers
easySuccess helper
or like this
easyError helper
or like this
2) Class
Firstly import the class, then create an instance.
You can add message, title, success, code, data or add custom key with chaining methods.
The response method is going to make it all together into an array then it responds as a json callback. If success is given as true, the response code will be 200. Additionally, you can add data, code, and custom key-value with the chaining methods.
If you want to remove the key that you added, you can use this method.
3) Static Class
Firstly import the class that initializes EasyResponse, then call the success or error method that you want to use.
You must to call response method after use.
Testing
I recommend testbench with "nunomaduro/collision" for testing.
Roadmap
- [x] The package were created
- [ ] More helpers function will be added
- [ ] Initial callbacks messages and their translations will be added
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
- İlker Akyel
- All Contributors
License
The MIT License (MIT). Please see License File for more information.