JSONize v1.6.0 - New Features and Enhanced Documentation
JSONize v1.6.0 - New Features and Enhanced Documentation
What's New:
-
Custom Key for Data:
- Added the ability to specify a custom key for data in the JSON response.
- Example:
Response::data(["id" => 1, "name" => "Item"], "item"); /* { "success": true, "message": null, "item": { "id": 1, "name": "Item" }, "status": [ 200, "ok" ] } */
-
Custom Message for Status:
- Added the ability to set a custom message for the HTTP status in the JSON response.
- Example:
Response::data(["id" => 1, "name" => "Item"], "item")->status(142, "example info")->hideMessage(); /* { "success": true, "item": { "id": 1, "name": "Item" }, "status": [ 142, "example info" ] } */
-
Hide Flags for Response Keys:
- Introduced functionality to remove specific keys from the JSON response based on hide flags.
- Example:
$response->data(["id" => 1, "name" => "Item"], "item")->hideStatus()->get(); /* { "success": true, "message": null, "item": { "id": 1, "name": "Item" } } */
-
New Examples Added:
- Added examples for data with a custom key, hiding status, and custom status messages in both Easy and Efficient modes.
- Examples included in the documentation for quick reference.
-
Improved Documentation:
- Updated the
README.md
with new examples for both Easy and Efficient modes, enhancing clarity and usability.
- Updated the
Contributing
Contributions are welcome! Add new HTTP status codes to the System/Traits/HasStatus.php
file. Submit a pull request or open an issue for any problems or suggestions.
License
JSONize is open-source software licensed under the MIT license.
Author
This library is created and maintained by Alireza Javadi. You can reach out to me at e@alirezajawadi.ir.
Upgrade now to streamline your JSON responses!