kosmosx / support
Utilities support.
Installs: 148
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:lumen
Requires
- php: ^7.1.3
- kosmosx/helpers: ~1.0
- league/fractal: ^0.18.0
This package is auto-updated.
Last update: 2024-10-25 07:51:03 UTC
README
composer require kosmosx/support
Register service poviders
/Kosmosx/Support/SupportServiceProvider::class
php artisan kosmosx:publish:support
Use it
$support = app('factory.support');
$statusSuccess = $support->success(200, $var, 'message...'); //return object StatusService
$statusFail = $support->fail(400, $var, 'message...'); //return object StatusService
$statusFail->isSuccess() //return false
$statusFail->isFail() //return true
$statusFail->toArray()
//result
[
"success"=>false,
"data"=>[...],
"message"=>"message...",
"statusCode"=>200
]
$api = $support->api()
$api->collection($data, $transformer, $includesData = null, $serializer = null) //Create collection with data Transformer
Route API auto discovery
\ApiService::apiDiscovery();