Code Generators are a nice way to speed up development by creating boiler-plate code based on your inputs. You may
already be familiar with the Laravel code generators (
php artisan make:controller).
Apiato code generator works the same way. In addition, it can generate a full Container with fully working CRUD operations, including routes, requests, controller, Actions, Repositories, Models, Migrations, documentation.... and much more)
To see the list of code generators type
To get more info about each command, add
--help to the command. Example:
php artisan apiato:generate:route --help. The help page shows all options, which can be directly passed to the command.
If you do not provide respective information via the command line options, a wizard will be displayed to guide you through.
For example, you can directly call
php artisan apiato:generate:controller --file=UserController to directly specify the class
to be generated. The wizard, however, will ask you for the
--container as well.
Note that all generators automatically inherit the options
--file (these are documented
as well in the help page). Furthermore, a generator may have specific options as well (e.g., the
to generate something for).
If you don't like the automatically generated code (or would like to adapt it to your specific needs) you can do this quite easily.
Generators allow to read
custom stubs from the
app/Ship/Generators/CustomStubs folder. The name of
file needs to be the same as in
Say, if you like to change the
config.stub, simply copy the file to
start adapting it to your needs.
If you run the respective command (e.g., in this case
php artisan apiato:generate:configuration)
this would read your specific
config.stub file instead the pre-defined one!
If you would like to add your own generators, please check out the Contribution Guide.
Checkout this awesome CRUD Containers generator package for Angular 2.4+.