abhishekdixit0407 / laravel-autocrud
A package to create automatic crud api for a specific resource
Installs: 29
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
pkg:composer/abhishekdixit0407/laravel-autocrud
Requires
- php: ^5.0|^7.0|^8.0
- laravel/framework: ^6.0|^7.0|^8.0|^9.0|^10.0
Requires (Dev)
- orchestra/testbench: ^7.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
README
Laravel AutoCrud is a handy package that helps you quickly create CRUD API(Create, Read, Update, Delete) API endpoints for your Laravel applications. With just a single Artisan command, you can generate all the necessary files to manage your resources effortlessly.
Installation
- You can install Laravel AutoCrud via Composer:
composer require abhishekdixit0407/laravel-autocrud
- After installation, To generate CRUD API endpoints for a resource, use the following command:
php artisan autocrud:api ResourceName --columns="name:string,email:string,data:json"
-
Replace ResourceName with the name of your unique resource(Example:User,Post,Medicine....etc). Use the --columns option to specify the columns of your database with its type (their is no limaitation to add column)
-
Modify migration file according to your need and run:
php artisan migrate
- Now your Laravel app have below routes registered with soft delete. To see routes:
| Method | Route | Route Name | Operation | description |
|---|---|---|---|---|
| Get | api/users | users_index | Index | You can also filter |
| the results, e.g: | ||||
| /users?name=abhi | ||||
| Get | api/users/{id} | users_view | View | |
| Post | api/users | users_create | Create | |
| Put | api/users/{id} | users_update | Update | |
| Delete | api/users/{id} | users_delete | Delete |