danjamesmills / laravel-response
Installs: 3 552
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^7.3|^8.0
- illuminate/support: ^7.0|^8.0|^9.0|^10.0|^11.0
Requires (Dev)
- orchestra/testbench: ^5.0|^6.0|^7.0|^8.0
- phpunit/phpunit: ^9.4
README
Introducing the Simple API Response Package for Laravel - a lightweight package that allows you to easily extend the functionality of your API's BaseController. This package provides simple helper methods for returning response codes and data. The methods include "sendResponse", "sendError" and "sendSuccess" which helps to return JSON responses with appropriate status codes and messages. With this package, you can streamline your API's response handling and ensure consistency throughout your application. This package is easy to use, and it can help you to keep your code clean and well-organized. The package is built with flexibility in mind, and it can easily adapt to your application's specific needs.
Installation
You can install the package via composer:
composer require danjamesmills/laravel-response
Usage
<?php namespace App\Http\Controllers\Api; use DanJamesMills\LaravelResponse\Http\Controllers\BaseController; class PostAPIController extends AppBaseController { public function store(PollAPIRequest $request) { return $this->sendResponse($poll->toArray(), 'Poll saved successfully'); } public function destroy($id) { return $this->sendSuccess('Poll deleted successfully'); } }
Testing
composer test
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 daniel620@hotmail.co.uk instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.