Download the PHP package jcsoriano/laravel-crud-templates without Composer
On this page you can find all versions of the php package jcsoriano/laravel-crud-templates. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jcsoriano/laravel-crud-templates
More information about jcsoriano/laravel-crud-templates
Files in jcsoriano/laravel-crud-templates
Package laravel-crud-templates
Short Description Laravel CRUD Templates - Generate complete CRUD operations with a single command
License MIT
Homepage https://github.com/jcsoriano/laravel-crud-templates
Informations about the package laravel-crud-templates
Laravel CRUD Templates
CRUD Templates for Laravel allows you to generate controllers, models, policies, requests, resources, migrations, factories, and even tests - all the files you need to complete CRUD features with a single command.
You can completely modify the template or create your own templates to fit your project's conventions perfectly.
Requirements
- PHP 8.4 or higher
- Laravel 11.0 or 12.0
Installation
You can install the package via Composer as a dev dependency:
The package will automatically register itself via Laravel's package discovery.
Publishing Stubs (Optional)
You can publish the stubs to customize them:
The Command
To generate a CRUD feature, you may use this command:
Quick Start Example
Sample command to generate a fully functioning RESTful API:
Generated Files
This command generates all the files needed to complete the CRUD feature, from routes, to validation, to authorization, to API responses, to migrations, to factories, to tests, and more.
app/Http/Controllers/Api/Content/PostController.phpapp/Models/Content/Post.phpapp/Policies/PostPolicy.phpapp/Http/Requests/Content/StorePostRequest.phpapp/Http/Requests/Content/UpdatePostRequest.phpapp/Http/Resources/Content/PostResource.phpdatabase/migrations/{timestamp}_create_posts_table.phpdatabase/migrations/{timestamp}_create_{pivot}_tables.php(if belongsToMany or morphToMany relationships are present)database/factories/Content/PostFactory.phptests/Feature/Api/Content/PostControllerTest.php- API routes automatically added to
routes/api.php(will runinstall:apiif the file doesn't exist yet) - Laravel Pint run on all generated files
Generated Routes
The command automatically registers the following routes in your routes/api.php file:
| HTTP Method | URI | Action | Description |
|---|---|---|---|
| GET | /api/posts |
index |
List all posts (paginated) |
| POST | /api/posts |
store |
Create a new post |
| GET | /api/posts/{id} |
show |
Show a specific post |
| PUT/PATCH | /api/posts/{id} |
update |
Update a post |
| DELETE | /api/posts/{id} |
destroy |
Delete a post |
Response Format
Single Resource:
Collection (with pagination):
Validation Rules
The request classes automatically include appropriate validation:
StorePostRequest:
Model Enhancements
The generated Post model will include several automatic enhancements:
Relationship Methods:
Type Casting:
Fillable Fields:
Migration with Foreign Keys
The migration includes proper foreign key constraints:
API Resource
The generated PostResource automatically includes relationships:
Documentation
Getting Started
- Installation - Requirements and installation guide
- Quick Start - Generate your first CRUD in minutes
Available Templates
- API Template - RESTful API CRUD generation
- Creating Your Own Template - Create templates for your own use cases
Using Templates
- Field Types - Complete list of supported field types
- Relationships - Working with model relationships
- Generate from Schema - Generate from existing database tables
Customizing Templates
- Customizing Stubs - Modify stub templates
- Customizing Generators - Override file generators
- Customizing Field Types - Extend with custom field types
- Customizing Printers - Customize code output
Support
If you find this package useful and would like to support its development, consider supporting me through one of these platforms:
Your support helps me continue building and maintaining this package. Thank you! 🙏
Coming Soon
- Filament CRUD Generator - a Filament GUI for generating CRUD features
- Livewire CRUD Generator - a CRUD template built for the Livewire starter kit
- Vue CRUD Generator - a CRUD template built for the Vue starter kit
- React CRUD Generator - a CRUD template built for the React starter kit
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- JC Soriano
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-crud-templates with dependencies
binafy/laravel-stub Version ^1.1
illuminate/contracts Version ^11.0||^12.0
spatie/laravel-package-tools Version ^1.16