PHP code example of eliseekn / laravel-api-response

1. Go to this page and download the library: Download eliseekn/laravel-api-response 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/ */

    

eliseekn / laravel-api-response example snippets


$this->response('success', 'Lorem ipsum dolor sit amet', 201);
$this->response('warning', [
    'key1' => 'value',
    'key2' => 'value'
], 405);

$this->successResponse('Lorem ipsum dolor sit amet');
$this->successResponse([
    'key1' => 'value',
    'key2' => 'value'
]);

$this->errorResponse(...);