ijodkor / laravel-api-response
Response util for Laravel
1.2.1
2024-11-29 11:06 UTC
Requires
- php: ^8.2
- illuminate/contracts: ^v11.1.0
Requires (Dev)
- orchestra/testbench: ^v9.0.1
- phpunit/phpunit: ^11.2.8
This package is not auto-updated.
Last update: 2025-01-14 05:47:30 UTC
README
Laravel API Response api uchun moslangan bo‘lib, mijoz javobni JSON shaklida qaytaruvchi va unga shakl berib jo‘natuvchi kutibxona.
Laravel API Response is a package that helps to provide and render a consistent HTTP JSON responses to API calls as well as converting and formatting exceptions to JSON responses.
Talablar (Requirements)
- PHP ^8.1
- Laravel ^10 | ^11
Talqinlar mutonosibligi (Version Compatibility)
O‘rnatish (Installation)
Install the package via composer:
composer require ijodkor/laravel-api-response
Ishlatish (Usage)
Add RestResponse trait to app module Controller file or any controller which is needed
use Ijodkor\ApiResponse\Responses\RestResponse; class Controller extends Controller { use RestResponse; } ... class UserController extends Controller { public function () { return $this->success([ 'user' => new User(); ]); } }
Mavjuda funksiyalar (Available functions)
Sovg‘a (Bonus)
This package also provided RestRequest to return json response Request validations
use Ijodkor\ApiResponse\Requests\RestRequest; // class UserRequest extends FormRequest - x class UserRequest extends RestRequest { }
Foydalanilgan manbalar (References)
- Testbench Laravel Testing Helper for Packages Development