Getting Started
Install Larahammer and scaffold your first CRUD application in minutes.
Requirements
- PHP 8.1 or higher
- Laravel 10, 11, 12, or 13
- Composer (for package installation)
Installation
Install the package via Composer:
bash
composer require larahammer/generatorThe package will auto-register in Laravel 5.5+. If you're using an older version, add the service provider to config/app.php:
php
'providers' => [
// ...
Larahammer\Generator\GeneratorServiceProvider::class,
],First CRUD
Generate a complete CRUD for a Product model:
bash
php artisan larahammer:make Product name:string price:decimal description:textThe command will prompt you to choose a target:
- blade - Blade views + Laravel controller
- filament - Filament admin resource
- api - REST API controller + JSON resource
- all - All three targets
Run Migrations
Execute the generated migration to create the database table:
bash
php artisan migrateSeed Data (Optional)
Populate the table with sample data:
bash
php artisan db:seed ProductSeederAccess Your CRUD
Depending on your chosen target:
Blade Views
- List:
GET /products - Create:
GET /products/create - Store:
POST /products - Edit:
GET /products/{id}/edit - Update:
PUT /products/{id} - Delete:
DELETE /products/{id}
Filament Admin
Access at /admin/resources/products (requires Filament installation)
REST API
- List:
GET /api/products - Create:
POST /api/products - Show:
GET /api/products/{id} - Update:
PUT /api/products/{id} - Delete:
DELETE /api/products/{id}
Configuration
Optionally publish the config file:
bash
php artisan vendor:publish --provider='Larahammer\\Generator\\GeneratorServiceProvider' --tag=configEdit config/larahammer.php:
php
return [
'default_target' => 'blade', // Change default target
'force' => false, // Overwrite existing files by default
];