Simple files generator used to easily create multiple files at once.
The package can be installed using composer.
composer require --dev vleroy/laravel-gen
# This will prompt you for {replacement values} found in folder's files
php artisan gen <folder name>
The files structure in the resources/templates/<folder>
folder will be replicated in the root folder of the project.
├── app
│ ├── ...
├── artisan
├── bootstrap
│ ├── ...
├── composer.json
├── config
│ ├── ...
├── database
│ ├── ...
├── public
│ ├── ...
├── resources
│ ├── ...
│ ├── templates
│ │ └── Model
│ │ ├── app
│ │ │ ├── Http
│ │ │ │ └── Controllers
│ │ │ │ └── {ModelName}Controller.php
│ │ │ ├── Models
│ │ │ │ └── {ModelName}.php
│ │ │ └── Services
│ │ │ └── {ModelName}Service.php
│ │ └── routes
│ │ └── {model_name}.php
├── routes
│ ├── ...
├── server.php
├── storage
│ ├── ...
- The
{my_value}
pattern indicates a dynamic value. - The command
php artisan <folder>
will prompt you for a replacement value. - These replacement values can be used in paths and in files content.
$ php artisan gen Model
ModelName:
> Post
model_name:
> post
model_table:
> posts
<?php
// Source -> resources/templates/Model/app/Models/{ModelName}.php
// Destination -> app/Models/Post.php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
protected $table = "posts";
...
}