From the beginning, Blueprint was designed to be extendable. There’s so much more code you could generate from the draft file, as well as add your own syntax.
Blueprint's primary focus will always be models and controllers. However, Blueprint encourages the Laravel community to create additional packages for generating even more components.
For example, generating HTML for CRUD views, or components for Laravel Nova.
Blueprint is bound to the container as a singleton. This means you can resolve an instance of the
Blueprint object either from within your own application or another Laravel package.
All of the parsing and code generation is managed by this
Blueprint. As such, you may register your own lexer or generator to generate additional code when
blueprint:build is run.
By registering a lexer, Blueprint will pass an array of the parsed tokens from the YAML file. With these, you could build your own data structures to add the Blueprints tree.
Each registered generator is then called with tree and responsible for generating code. By default, this contains the parsed
controllers. However, it may also contain additional items you may have placed in the tree with a lexer.
In addition, I also discuss the architecture for extending Blueprint as well as adding new syntax for database seeders during this weekly Blueprint live-stream.
You may use these addons in your projects or as an example of how to create your own and possibly share them with the Laravel community.
- Laravel Nova: Automatically generate Nova resources for each of the models specified in your draft file.
- Pest Test Generator: Generate Pest tests, instead of the standard Laravel/PHPUnit tests.
- API Resources Tests: Generate test code similar to Blueprint, but using an opinionated and streamlined style.
- TALL-forms: Automatically generate TALL forms for each of the models specified in your draft file.
The following services also support using Blueprint by either accepting or generating a draft file.
- drawSQL: Generate draft file from your database entity relationship diagrams.