soloslee/json-response
Json Response
Installation
Install using composer:
composer require soloslee/json-response
Laravel (optional)
Add the service provider in config/app.php:
'Soloslee\JsonResponse\JsonResponseServiceProvider::class',
And add the JsonResponse alias to config/app.php:
'JsonResponse' => Soloslee\JsonResponse\Facades\JsonResponse::class,
Basic Usage
Start by creating an JsonResponse instance (or use the JsonResponse Facade if you are using Laravel):
use Soloslee\JsonResponse\JsonResponse;
return JsonResponse::success();
Success
JsonResponse::success([
'id' => $user->id,
'phone' => $user->phone,
'email' => $user->email,
'authorized' => $user->cleaner,
'token' => $user->token
]);
Error
JsonResponse::error('Fails to send message.', 602);
License
Laravel Json Response is licensed under MIT license.
Related Packages
nilportugues/laravel5-json-api-dingo
Laravel5 JSONAPI and Dingo together to build APIs fast
1,498
30
aimeos/aimeos-laravel
Cloud native, API first Laravel eCommerce package with integrated AI for ultra-f...
239,141
8,703
cloudcreativity/laravel-json-api
JSON API (jsonapi.org) support for Laravel applications.
1,108,760
782
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v1.0.0 | >=5.3.2 | ~5.0 | MIT |