An easy extension of the Artisan make commands to modify the command's stubs and to generate fully implemented php files.
⚠️ This repository has been archived since the functionality of the package is now natively supported by Laravel 7. See the Laravel 7 changelog for details.
This package is an easy extension of the Artisan make commands provided by your Laravel application to have the ability to modify the command's stubs to your personal needs and to generate fully implemented php classes (controller, requests, policies, etc.) for a specified model.
For the latest command options as described in the Wiki of this package use the latest Laravel version.
To get started, install the package via the Composer package manager:
composer require ferdinandfrank/laravel-file-generator --dev
Replace the entry
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::classwithin your providers array in
'providers' => [ ... // Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, FerdinandFrank\LaravelFileGenerator\Providers\ConsoleSupportServiceProvider::class, ... ]
The package should be auto-discovered by Laravel. For manual registration, add the following entry to your providers array in
'providers' => [ ... ... FerdinandFrank\LaravelFileGenerator\Providers\FileGeneratorServiceProvider::class ]
You can use the Artisan make commands provided by your Laravel application as always. This package is just an extension to provide more options and the flexibility to specify your own stub files.
For example, just execute the following command to create a new controller class with the name
UserController but with your custom specified stub file (if one exist):
php artisan make:controller UserController
For more details as well as a list of all available commands have a look at the wiki of this package.
To have the full benefits of this package you can execute the following command to publish all the stub files which are used to create the php files when executing an Artisan make command.
php artisan vendor:publish --tag=stubs
By default the stub files will be copied to the
resources\stubs folder of your application. As soon as you call
an Artisan make command after you executed this publishing command the stub files for generating
a new php file will be used as the template from this folder. To modify the path to your stubs file have a look
on the next section 'Configuration'.
You have the possibility to modify the path to your stub files as well as other configuration options. Therefore you need to publish the configuration file of this package by the following command.
php artisan vendor:publish --tag=config
This command will generate the file
laravel-file-generator.php within your config folder of your Laravel application.
You can see all details and documentation about the available make commands on the wiki of this package.