Laravel Eloquent Generator
- PHP 7.2+
- PDO driver
The code generated can use in following Laravel version:
- Laravel 4.0 ~ 6.x
- MySQL
- SQLite
- PostgreSQL
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
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 generated
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.
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.
Clone this repository and execute command:
make
The make
command will generate eloquent-generator.phar
file which is executable.