PHP code example of rahulp / crud-generator

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

    

rahulp / crud-generator example snippets


ok($message = null, $data = [], $status = 200);

// Examples:
return ok('User profile fetched', $user);
return ok('Post created', $post, 201);

error($message = null, $data = [], $type = null);

// Examples:
return error('Validation failed', $validator->errors(), 'validation');
return error('Post not found', [], 'notfound');
return error('Unauthorized access', [], 'forbidden');
bash
php artisan project:setup
bash
php artisan make:crud {model} {columns}

app/
├── Http/
│   ├── Controllers/
│   │   └── PostController.php
│   └── Middleware/
│       └── DBTransaction.php
├── Models/
│   └── Post.php
├── Repositories/
│   ├── Interfaces/
│   │   └── PostRepositoryInterface.php
│   └── PostRepository.php
├── Services/
│   └── PostService.php
└── Helpers/
    └── functions.php