ferdinandfrank/laravel-file-generator

This package is abandoned and no longer maintained. No replacement package was suggested.

An easy extension of the Artisan make commands to modify the command's stubs and to generate fully implemented php files.

v1.3 2019-05-02 14:45 UTC

This package is not auto-updated.

Last update: 2020-05-01 18:39:23 UTC


README

Packagist Version Packagist GitHub license

⚠️ 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.

Requirements

  • PHP >=7.0.0
  • An existing >= Laravel 5.5 project (For Laravel 5.4 see version 1.0)

For the latest command options as described in the Wiki of this package use the latest Laravel version.

Installation

  1. To get started, install the package via the Composer package manager:

    composer require ferdinandfrank/laravel-file-generator --dev
  2. Replace the entry Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class within your providers array in config/app.php:

    'providers' => [
       ...
       // Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
       FerdinandFrank\LaravelFileGenerator\Providers\ConsoleSupportServiceProvider::class,
       ...
    ]
  3. The package should be auto-discovered by Laravel. For manual registration, add the following entry to your providers array in config/app.php:

    'providers' => [
       ...
       ...
       FerdinandFrank\LaravelFileGenerator\Providers\FileGeneratorServiceProvider::class
    ]

That's it!

Usage

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.

Publishing stub files

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'.

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.

Commands

You can see all details and documentation about the available make commands on the wiki of this package.

License

MIT