GitHub - 104corp/laravel-eloquent-generator: Laravel ORM Model Generator
source link: https://github.com/104corp/laravel-eloquent-generator
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
README.md
Laravel Eloquent Generator
Laravel Eloquent Generator
System Requirement
- PHP 5.5+
- Laravel 5.2 ~ 5.4 ,see Requirement
- PDO driver
Support Database
- MySQL
- SQLite
- PostgreSQL
Installation
Download the Release phar file and execute it:
chmod +x eloquent-generator.phar ./eloquent-generator.phar
Or move into /usr/local/bin
:
mv eloquent-generator.phar /usr/local/bin/eloquent-generator eloquent-generator
Usage
In the Laravel project, you can run this command directly:
cd /path/to/your-laravel-project
eloquent-generator
It's will generate model code into build
directory, use the --output-dir
option can change output dir. If want to change namespace, use the --namespace
option.
In the other framework but using Eloquent ORM library, you must provide config file like laravel project.
This command using hassankhan/config
to load config file like PHP, JSON, YAML, etc. Use --config-file
option to specify custom config.
If only want build one connection, use the --connection
option to specify.
Use the --overwrite
option if you want to overwrite exist code.
Using Docker
See the info about Docker at DockerHub.
Just like using phar, you can run this command in the Laravel project:
cd /path/to/your-laravel-project docker run -it --rm -v `pwd`:/source 104corp/eloquent-generator
Or set the alias will more like phar:
alias eloquent-generator='docker run -it --rm -v $PWD:/source 104corp/eloquent-generator' eloquent-generator
See more info about option at Usage section.
Build Yourself
Clone this repository and execute command:
make
The make
command will generate eloquent-generator.phar
file which is executable. You can execute this file or move into /usr/local/bin
:
sudo mv eloquent-generator.phar /usr/local/bin/eloquent-generator eloquent-generator
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK