PHP code example of slps970093 / laravel-api-response

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

    

slps970093 / laravel-api-response example snippets




use Slps970093\LaravelApiResponse\Traits\HasResponse;
class Demo {
    use HasResponse;
    
    public function index()
    {
        return $this->ok([]);
    }
}



use Slps970093\LaravelApiResponse\Exceptions\ApiException;

class Demo {
    
    public function index()
    {
        throw new ApiException("aaa");
    }
}