Extending Blueprint

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 models and 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.

Community Addons

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.

Additional Services

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.