kosmosx/support

Utilities support.

Installs: 149

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:lumen

1.0.0 2019-08-24 11:28 UTC

This package is auto-updated.

Last update: 2024-11-25 07:57:48 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();