gabrieloliverio/laravel5-generators

Database metadata-based generators for Laravel 5

v1.0.2 2017-07-19 03:30 UTC

This package is not auto-updated.

Last update: 2019-12-07 21:10:33 UTC


README

Build Status Code Climate

Laravel Generators with Steroids!

Laravel's built-in generators are great... but they'd be just perfect if they could fetch some database metadata to generate our models and controllers, right?! That's what this project aims to do - generate objects in a flexible way, allowing you to customize the generated code, defining your own templates and parameters.

You can simply use the commands defined in the project, create your own commands or even an application with GUI that uses Laravel5-Generators as a library to generate code. It's up to you.

Installation

Run the following command to install the package:

composer require gabrieloliverio/laravel5-generators --dev

Additionally, install php-cs-fixer, in order to beautify the generated code:

composer require friendsofphp/php-cs-fixer --dev

Once installed, open up config/app.php file, find the providers key and add the following line to the bottom:

Bronco\LaravelGenerators\Providers\GeneratorsServiceProvider::class,

Publish the configuration file running the following command:

php artisan vendor:publish --tag=generators

This will copy the configuration file to config/generators.php. You can explore and change the default values, if you wish.

Now include the following lines inside the $commands property, in the app/Console/Kernel.php file:

\Bronco\LaravelGenerators\Commands\Model::class,
\Bronco\LaravelGenerators\Commands\Controller::class

Usage

The easiest way to use Laravel5-Generators is through its commands, to generate models and controllers.

Generate Model:

php artisan make:bronco:model Path/To/Model

Generate Controller

php artisan make:bronco:controller Path/To/Controller

License

The Laravel5-Generators is licensed under the MIT license.