byancode / blueprint
An expressive, human readable code generation tool.
Requires
- doctrine/dbal: ^2.9|^3.0
- illuminate/console: ^6.0|^7.0|^8.0
- illuminate/filesystem: ^6.0|^7.0|^8.0
- illuminate/support: ^6.0|^7.0|^8.0
- laravel-shift/faker-registry: ^0.1
- symfony/yaml: ^4.3|^5.0
Requires (Dev)
- mockery/mockery: ^1.3
- orchestra/testbench: ^4.0|^5.0|^6.0
- phpunit/phpunit: ^8.0|^9.3
Suggests
- jasonmccreary/laravel-test-assertions: Required to use additional assertions in generated tests (^1.0).
- dev-master
- v1.23.2
- v1.23.1
- v1.23.0
- v1.22.0
- v1.21.0
- v1.20.2
- v1.20.1
- v1.20.0
- v1.19.2
- v1.19.1
- v1.19.0
- v1.18.0
- v1.17.0
- v1.16.0
- v1.15.3
- v1.15.2
- v1.15.1
- v1.15.0
- v1.14.0
- v1.13.2
- v1.13.1
- v1.13.0
- v1.12.0
- v1.11.2
- v1.11.1
- v1.11.0
- v1.10.1
- v1.10.0
- v1.9.1
- v1.9.0
- v1.8.0
- v1.7.1
- v1.7.0
- v1.6.0
- v1.5.1
- v1.5.0
- v1.4.1
- v1.4.0
- v1.3.1
- v1.3.0
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.1
- 1.1.0
- 1.0.1
- 1.0.0
- 0.5.1
- 0.5.0
- 0.4.0
- 0.3.0
- 0.2.1
- 0.2.0
- 0.1
- dev-fix-417
- dev-spaceemotion-use-aliased-import-for-resources
- dev-faker-registry
- dev-fix-292
- dev-fix-291
- dev-fix-207
This package is auto-updated.
Last update: 2025-01-06 20:24:18 UTC
README
Blueprint is an open-source tool for rapidly generating multiple Laravel components from a single, human readable definition.
Watch a quick demo of Blueprint in action and continue reading this document to get started.
Requirements
Blueprint requires a Laravel application running version 6.0 or higher.
Installation
You can install Blueprint via composer using the following command:
composer require --dev laravel-shift/blueprint
Blueprint will automatically register itself using package discovery.
Additional Configuration: If you are running Laravel 8, or registering class-based routes or using the app/Models
folder, you will need to configure Blueprint. Please review the Blueprint Docs for additional guidance.
Basic Usage
Blueprint comes with a set of artisan commands. The one you'll use the most is the blueprint:build
command to generate the Laravel components:
php artisan blueprint:build [draft]
The draft file contains a definition of the components to generate.
Let's review the following, example draft file to generate some blog components:
models: Post: title: string:400 content: longtext published_at: nullable timestamp author_id: id:user controllers: Post: index: query: all render: post.index with:posts store: validate: title, content, author_id save: post send: ReviewPost to:post.author.email with:post dispatch: SyncMedia with:post fire: NewPost with:post flash: post.title redirect: post.index
From these simple 20 lines of YAML, Blueprint will generate all of the following Laravel components:
- A model class for
Post
complete withfillable
,casts
, anddates
properties, as well as relationships methods. - A migration to create the
posts
table. - A factory intelligently setting columns with fake data.
- A controller class for
PostController
withindex
andstore
actions complete with code generated for each statement. - Routes for the
PostController
actions. - A form request of
StorePostRequest
validatingtitle
andcontent
based on thePost
model definition. - A mailable class for
ReviewPost
complete with apost
property set through the constructor. - A job class for
SyncMedia
complete with apost
property set through the constructor. - An event class for
NewPost
complete with apost
property set through the constructor. - A Blade template of
post/index.blade.php
rendered byPostController@index
.
Note: This example assumes features within a default Laravel application such as the User
model and `app.blade.php
layout. Otherwise, the generated test may have failures.
Documentation
Browse the Blueprint Docs for full details on defining models, defining controllers, advanced configuration, and extending Blueprint.