PHP code example of ijodkor / laravel-api-response

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

    

ijodkor / laravel-api-response example snippets


use Ijodkor\ApiResponse\Responses\RestResponse;

class Controller extends Controller {
    use RestResponse;
}

...

class UserController extends Controller {
    public function () {
        return $this->success([
            'user' => new User();
        ]);
    }
}

use Ijodkor\ApiResponse\Requests\RestRequest;

// class UserRequest extends FormRequest - x
class UserRequest extends RestRequest {

}