Blueprint Commands

Blueprint comes with a set of artisan commands which are helpful during code generation. All of these commands are under the blueprint namespace.

While we will cover each of the commands below, you may get additional help for any of these commands by using the --help option. For example:

php artisan blueprint:build --help

Build Command

The blueprint:build command is the one you'll use most often as this handles Generating Components.

It accepts a single argument of path to your draft file. This argument is optional. By default, Blueprint will attempt to load a draft.yaml (or draft.yml) file from the project root folder.

As such, it's convenient to use the draft.yaml file for defining components, but reuse it instead of creating separate draft files each time you run the blueprint:build command.

When complete, blueprint:build will output a list of the files it created and updated.

New Command

Blueprint includes a blueprint:new command. This command may be helpful when you want to start using Blueprint within your project.

The blueprint:new command will generate a draft.yaml file with stubs for the models and controllers sections, as well as run the trace command to preload your existing models into Blueprint's cache.

Erase Command

Blueprint also comes with a blueprint:erase command. Anytime you run blueprint:build, the list of generated components is cached in a local .blueprint file.

The blueprint:erase command can be used to undo the last blueprint:build command. Upon running this command, any of the files generated during the last build will be deleted.

If you realize a mistake after running blueprint:build and would like to rebuild your components, your may run blueprint:erase and blueprint:build.

Trace Command

When using Blueprint with existing applications, you may need to reference existing models when generating new components. Furthermore, even though Blueprint caches the generated model definitions in a .blueprint file, this file may become outdated as you continue to develop your application.

At anytime, you may run the blueprint:trace command to have Blueprint analyze your application and update its cache with all of your existing models.