tarsoft / laravel-auto
A package to auto-generate CRUD for Laravel models
Requires
- php: >=7.4
- illuminate/support: ^8.0|^9.0|^10.0
Requires (Dev)
- phpunit/phpunit: ^11.4
This package is not auto-updated.
Last update: 2025-04-01 11:13:28 UTC
README
Description
Laravel Auto is a package designed to automate CRUD (Create, Read, Update, Delete) generation for Laravel applications, making it quick and efficient to scaffold models, controllers, views, and routes with a single command. It supports both web and API generation, allowing developers to focus on application logic rather than repetitive setup.
Motivation
The process of building CRUD operations is crucial for most applications but can be time-consuming and repetitive. Laravel Auto solves this by automating CRUD generation, ensuring consistency across projects and aligning with Laravel's best practices. This package is developed to help developers:
- Increase Productivity: Automatically generate essential parts of Laravel applications, saving time and effort on boilerplate code.
- Maintain Consistency: Standardize patterns across projects, reducing errors and improving maintainability.
- Adopt API-First Design: Easily set up API routes and controllers, supporting modern development practices.
- Empower All Developers: With a simple command, this package is accessible to beginners while being flexible enough for experienced developers.
Features
- Generates a Model with fillable attributes
- Generates a Controller with CRUD methods for web or API setup
- Creates Views (index, show, create, edit) for web routes
- Appends routes to
web.php
orapi.php
based on setup type
Installation
To install the Laravel Auto package, follow these steps:
-
Install the package using Composer:
composer require tarsoft/laravel-auto
-
Publish the stubs (optional):
php artisan vendor:publish --tag=tarsoft-stubs
Usage
Generating Web CRUD
To generate a CRUD structure for a model (e.g., Blog
) with web controllers and views, run:
php artisan auto:crud Blog
This will create:
Blog
model (inapp/Models/
)BlogController
(inapp/Http/Controllers/
)- Views (
index
,show
,create
,edit
) underresources/views/blogs/
- Web routes in
routes/web.php
Generating API CRUD
For API-only routes and controllers, use the --api
flag:
php artisan auto:crud Blog --api
This will create:
Blog
model (inapp/Models/
)BlogController
(inapp/Http/Controllers/API/
)- API routes in
routes/api.php
License
Laravel Auto is open-source software licensed under the MIT license.