mdarmancse / autolara
Auto CRUD generation with Repository Pattern
Installs: 19
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/mdarmancse/autolara
Requires
- php: >=8.0
- illuminate/support: ^11.0
README
AutoLara is a Laravel package that automatically generates CRUD operations, including models, migrations, controllers, repositories, and routes based on a simple Artisan command.
Features
- 🔹 Generates Model, Migration, Controller, Repository, and Form Requests.
- 🔹 Updates Routes automatically.
- 🔹 Runs migration after generation.
- 🔹 Uses stub templates for customization.
Installation
Run the following command to install AutoLara:
composer require mdarmancse/autolara
Usage
Run the following command to generate CRUD for a model with specified fields:
php artisan autolara:crud ModelName field1:type field2:type ...
Example:
php artisan autolara:crud Product name:string price:integer is_active:boolean
Expected Output:
🔄 Generating CRUD for: Product
✅ Model created: Product
✅ Migration created: products
✅ Repository for Product generated.
✅ Controller created: ProductController
✅ Form request for Product generated.
✅ Routes for Product updated.
⚡ Running Migration...
✅ Migration successful.
Stubs Customization
You can customize the stub templates by copying them to resources/stubs/:
mkdir -p resources/stubs cp -r vendor/mdarmancse/autolara/stubs resources/stubs
Then modify the stub files inside resources/stubs/ to fit your project requirements.
Available Field Types
The package supports the following field types:
stringintegerbooleantextdatedatetimefloatdouble
Troubleshooting
1. Stub File Not Found Error
If you encounter this error:
❌ Error: Stub file not found: vendor/mdarmancse/autolara/stubs/model.stub
Try running:
php artisan config:clear && php artisan cache:clear
If the issue persists, ensure that the stub files exist in the vendor/mdarmancse/autolara/stubs/ directory.
2. Migration File Not Found Error
If you see:
❌ Error: File does not exist at path database/migrations/xxxx_xx_xx_xxxxxx_create_products_table.php
Manually run:
php artisan migrate
🚀 Happy Coding!