Download the PHP package ajz/api-response without Composer
On this page you can find all versions of the php package ajz/api-response. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ajz/api-response
More information about ajz/api-response
Files in ajz/api-response
Package api-response
Short Description Elegant and consistent API response helpers for Laravel applications with proper HTTP status codes and standardized JSON responses.
License MIT
Informations about the package api-response
Laravel API Response Helpers
A elegant and consistent API response helper package for Laravel applications. Simplify your API responses with standardized JSON formats and proper HTTP status codes.
Requirements
- PHP 8.3 or higher
- Laravel 11.0 or higher
Installation
You can install the package via composer:
Usage
Add the ApiResponseHelpers
trait to your controller:
Available Methods
Success Responses
Error Responses
Custom Success Response
You can customize the default success response:
Supported Data Types
The package supports various data types for responses:
- Arrays
- Laravel Collections
- Objects implementing Arrayable
- Objects implementing JsonSerializable
Response Format Examples
Success Response
Success Response with Data
Error Response
Validation Error Response
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
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate. markdown
Changelog
All notable changes to laravel-api-helpers
will be documented in this file
1.0.0 - 202X-XX-XX
- initial release
markdown
Contributing
Contributions are welcome and will be fully credited.
Please read and understand the contribution guide before creating an issue or pull request.
Etiquette
This project is open source, and as such, the maintainers give their free time to build and maintain the source code held within. They make the code freely available in the hope that it will be of use to other developers. It would be extremely unfair for them to suffer abuse or anger for their hard work.
Please be considerate towards maintainers when raising issues or presenting pull requests.
Requirements
If the project maintainer has any additional requirements, you will find them listed here.
-
PSR-2 Coding Standard - The easiest way to apply the conventions is to install PHP Code Sniffer.
-
Add tests! - Your patch won't be accepted if it doesn't have tests.
-
Document any change in behaviour - Make sure the
README.md
and any other relevant documentation are kept up-to-date. -
Consider our release cycle - We try to follow SemVer v2.0.0. Randomly breaking public APIs is not an option.
- One pull request per feature - If you want to do more than one thing, send multiple pull requests.