Download the PHP package victoryoalli/laravel-code-generator without Composer
On this page you can find all versions of the php package victoryoalli/laravel-code-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download victoryoalli/laravel-code-generator
More information about victoryoalli/laravel-code-generator
Files in victoryoalli/laravel-code-generator
Package laravel-code-generator
Short Description A PHP Package for Code Generation.
License MIT
Homepage https://github.com/victoryoalli/laravel-code-generator
Informations about the package laravel-code-generator
Laravel Code Generator is a PHP Laravel Package that uses Blade template engine to generate code for you.
The difference between other code generators is that this one will generate the code exactly as you want it to be, same design, same lines of code.
Demo
Installation
Use composer to install Laravel Code Generator.
Usage
Single file generation
Example Output
Multiple file generator
First create a custom command like this example
Create a Custom Command
Custom Command
Execute custom command
Templates & Customization
Templates are located at resources/vendor/laravel-code-generator
.
For example once you publish the views the file schema.blade.json
will be located at the relative path is resources/vendor/laravel-code-generator\schema.blade.json
.
The path resources/views/vendor/laravel-code-generator
is where you can create your own new templates, or customize the existing ones.
Publish template views & Config
You can publish :
or the config file
This is the contents of the published config file
config/laravel-code-generator.php
:
By default you can use as templates files with following extensions, if you need to generate or use different files as templates you can add to the config file.
Structure
- Model (object)
- name (string)
- table (object)
- relations (array)
- Table (object)
- name (string)
- columns (array)
- Column (object)
- name (string)
- type (string)
- length (integer)
- nullable (boolean)
- autoincrement (boolean)
- default (string)
- Relations (array)
- name (string)
- type (string)
- local_key (string)
- foreign_key (string)
- model (array)
Example
Output Sample
Helpers
PHPSOL()
: PHP Start Of Line
Will print
doubleCurlyOpen()
: Opening Double Curly Braces
Will print:
doubleCurlyClose()
: Closing Double Curly Braces
Will print:
tag('x-component-name')
: Closing Double Curly Braces
Will print:
CodeGenerator::generate Facade
This is how you can use the Facade when you want to create your own Code Generator.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
All versions of laravel-code-generator with dependencies
illuminate/console Version ^8.0|^9.0|^10.0
illuminate/filesystem Version ^8.0|^9.0|^10.0
illuminate/support Version ^8.0|^9.0|^10.0
doctrine/dbal Version ^2.9|^3.0
spatie/laravel-ray Version ^1.18