PHP code example of mrcookie / simple-api-crud-generator

1. Go to this page and download the library: Download mrcookie/simple-api-crud-generator 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/ */

    

mrcookie / simple-api-crud-generator example snippets


php artisan api-crud:generate [App/Models/User or User or user]

Route::name('users.')->prefix('users')->group(function () {
    Route::get('', App\Api\Actions\Users\GetUsersAction::class);
    Route::get('{id}', App\Api\Actions\Users\ShowUserAction::class);
    Route::put('{id}', App\Api\Actions\Users\UpdateUserAction::class);
    Route::delete('{id}', App\Api\Actions\Users\DeleteUserAction::class);
});

class User extends Model {
    public static array $allowedFilters = [
        'name'
    ];
    
    public static array $allowedFields = [
        'name'
    ];
}

visit [http://localhost:8000/docs/api] to see the generated docs api routes