Download the PHP package ashique-ar/laravel-crud-generator without Composer
On this page you can find all versions of the php package ashique-ar/laravel-crud-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ashique-ar/laravel-crud-generator
More information about ashique-ar/laravel-crud-generator
Files in ashique-ar/laravel-crud-generator
Package laravel-crud-generator
Short Description A powerful, configuration-driven CRUD API generator for Laravel with advanced features including permissions, filtering, sorting, bulk operations, and custom logic handlers.
License MIT
Homepage https://github.com/ashique-ar/laravel-crud-generator
Informations about the package laravel-crud-generator
Laravel CRUD Generator
A powerful, configuration-driven CRUD API generator for Laravel applications. Generate complete REST APIs with advanced features like permissions, filtering, sorting, validation, and custom business logic handlers - all through simple configuration.
โจ Features
- ๐ Zero-Code CRUD APIs - Generate complete REST APIs through configuration
- ๐ Permission Integration - Built-in support for Spatie Laravel Permission
- ๐ฏ Custom Logic Handlers - Extend with custom business logic easily
- ๐ Advanced Filtering - Search across multiple fields with configurable operators
- ๐ Smart Sorting - Multi-field sorting with default configurations
- โก Bulk Operations - Perform operations on multiple resources at once
- ๐๏ธ Soft Deletes Support - Full soft delete support with restore capabilities
- โ Automatic Validation - Validation rules defined in configuration
- ๐ API Documentation - Auto-generated OpenAPI/Swagger documentation
- ๐ ๏ธ Artisan Commands - Powerful commands for scaffolding and management
- ๐งช Fully Tested - Comprehensive test suite included
๐ Requirements
- PHP 8.1+
- Laravel 10.x | 11.x | 12.x
- Spatie Laravel Permission (automatically installed)
๐ฆ Installation
Install the package via Composer:
Run the installation command:
This will:
- Publish the configuration file
- Set up middleware
- Register routes
- Generate initial permissions (optional)
๐ Quick Start
1. Configure Your First Resource
Edit config/crud.php
to define your resources:
2. Register Routes
Add the CRUD routes to your routes/api.php
file:
3. Generate Permissions
4. Start Using Your API
Your CRUD endpoints are now available:
๐ Available Endpoints
For each configured resource, the following endpoints are automatically generated:
Method | Endpoint | Description |
---|---|---|
GET |
/api/v1/{resource} |
List resources with pagination, search, and sorting |
POST |
/api/v1/{resource} |
Create a new resource |
GET |
/api/v1/{resource}/{id} |
Get a specific resource |
PUT/PATCH |
/api/v1/{resource}/{id} |
Update a resource |
DELETE |
/api/v1/{resource}/{id} |
Delete a resource |
POST |
/api/v1/{resource}/bulk |
Bulk operations (if enabled) |
GET |
/api/v1/{resource}/trashed |
List soft-deleted resources (if enabled) |
POST |
/api/v1/{resource}/{id}/restore |
Restore soft-deleted resource (if enabled) |
DELETE |
/api/v1/{resource}/{id}/force |
Force delete resource (if enabled) |
GET |
/api/v1/{resource}/docs |
API documentation for the resource |
Query Parameters
Pagination
page
- Page number (default: 1)per_page
- Items per page (default: 15, max: 100)
Search
search
- Search term across configured searchable fieldssearch_operator
- Search operator:like
,exact
,starts_with
,ends_with
(default:like
)
Sorting
sort
- Field to sort bydirection
- Sort direction:asc
ordesc
(default:asc
)
Filtering
filter[field]
- Filter by specific field valuefilter[field][operator]
- Filter with specific operator (=
,!=
,>
,<
,>=
,<=
,like
,in
,between
)
๐ง Advanced Usage
Model Namespacing
The package supports flexible model namespacing to accommodate different project structures:
When using artisan commands, you can specify models in several ways:
Custom Logic Handlers
Create custom business logic for your resources:
This generates:
Then update your configuration:
Adding New Resources
Use the artisan command to quickly add new resources:
This will interactively help you configure:
- Model class and table
- Fillable fields
- Validation rules
- Search and sort configuration
- Permissions
- Relations
- Custom logic handler (optional)
Bulk Operations
Perform operations on multiple resources:
Permissions
The package integrates seamlessly with Spatie Laravel Permission:
API Documentation
Access auto-generated documentation:
Returns OpenAPI 3.0 compatible JSON that can be used with Swagger UI or similar tools.
๐ Configuration
The package uses a comprehensive configuration system in config/crud.php
. Here's a complete reference:
Global Configuration
Resource Configuration Options
Each resource supports the following configuration options:
Validation Rule Placeholders
In validation rules, you can use placeholders that will be replaced during validation:
{{id}}
- The ID of the current resource (useful for unique rules in updates){{user_id}}
- The ID of the authenticated user{{resource}}
- The name of the current resource
Example:
๐งช Testing
Run the package tests:
Run tests with coverage:
๐ Configuration
See the Configuration Guide for detailed configuration options.
๐ 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.
๐ License
The MIT License (MIT). Please see License File for more information.
๐ Credits
- Your Name
- All Contributors
๐ก Support
Made with โค๏ธ for the Laravel community
All versions of laravel-crud-generator with dependencies
laravel/framework Version ^10.0|^11.0|^12.0
spatie/laravel-permission Version ^5.0|^6.0