cwssrl / eloquent-lumen-generator
Eloquent Lumen Generator
Requires
- php: ~7.2
- cwssrl/code-generator: ^1.0.4
- doctrine/dbal: ^2.5
- illuminate/routing: ^6.0
- laravel/lumen-framework: ^6.0
Requires (Dev)
- phpunit/phpunit: ^8
- squizlabs/php_codesniffer: ^3.5
Suggests
- Astrotomic/laravel-translatable: Allows to configure translation tables
README
Eloquent Lumen Generator is a tool based on Code Generator for generating Eloquent models. It comes with the possibility to generate the following items:
- Model;
- Repository and Contracts, binding them into the bootstrap/app.php file;
- Api Controller;
- Routes;
- Resources;
- Translation management for tables. It manages MySql and PostgreSql as database.
Requirements
To make this package works you have to make your migrations and run them. All the package will create items based on the table that it can find on the database set on your .env file.
Installation
Step 1. Add Eloquent Lumen Generator to your project:
composer require cwssrl/eloquent-lumen-generator --dev
Step 2. Register GeneratorServiceProvider
in bootstrap/app.php file:
$app->register(Cws\EloquentModelGenerator\Provider\GeneratorServiceProvider::class);
Step 3. Uncomment AppServiceProvider in bootstrap/app.php file:
Step 4 (optional). If you want to edit package configurations, you have to copy vendor/cwssrl/eloquent-lumen-generator/src/Resources/eloquent_model_generator.php into your config folder.
Usage
Use
php artisan cws:generate Book --all-api
to generate all you need for the Book class. Generator will look for table with name books
and generate the model, the repo, the contract, the controller, the routes for it.
You can also generate data for all your tables at once
php artisan cws:generate all --all-api
Valid options
You can use these options as command parameters
Contributing
Please see CONTRIBUTING for details.
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Credits
This package is heavily based on Cws Code Generator that is a fork of the krlove/code-generator package
License
The MIT License (MIT). Please see License File for more information.