PHP code example of offspring / laravel-handle-responder

1. Go to this page and download the library: Download offspring/laravel-handle-responder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

offspring / laravel-handle-responder example snippets


return responder()->success();

return responder()->error();

return responder()->success()->respond();

return responder()->error()->respond();

return responder()->success()->respond(201, ['x-foo' => true]);

return responder()->error()->respond(404, ['x-foo' => false]);

return responder()->success()->toArray();

return responder()->error()->toArray();

'decorators' => [
    \Offspring\Responder\Http\Responses\Decorators\StatusCodeDecorator::class,
    \Offspring\Responder\Http\Responses\Decorators\SuccessFlagDecorator::class,
],

return responder()->success()->decorator(ExampleDecorator::class)->respond();

return responder()->error()->decorator(ExampleDecorator::class)->respond();

\Offspring\Responder\Http\Responses\Decorators\PrettyPrintDecorator::class,

\Offspring\Responder\Http\Responses\Decorators\EscapeHtmlDecorator::class,
shell
php artisan vendor:publish --provider="Offspring\Responder\ResponderServiceProvider"