gabrieloliverio / laravel5-generators
Database metadata-based generators for Laravel 5
Requires
- php: >=5.5.9
- illuminate/config: >=5.2
- illuminate/database: >=5.2
- illuminate/filesystem: >=5.2
- illuminate/support: >=5.2
- vlucas/phpdotenv: ~2.2
Requires (Dev)
- mockery/mockery: ^0.9.7
- phpunit/phpunit: 4.8.*
This package is not auto-updated.
Last update: 2021-04-25 14:59:44 UTC
README
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.