Giter Site home page Giter Site logo

blueprint's Introduction

Build Status Latest Stable Version License

Blueprint

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 with fillable, casts, and dates 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 with index and store actions complete with code generated for each statement.
  • Routes for the PostController actions.
  • A form request of StorePostRequest validating title and content based on the Post model definition.
  • A mailable class for ReviewPost complete with a post property set through the constructor.
  • A job class for SyncMedia complete with a post property set through the constructor.
  • An event class for NewPost complete with a post property set through the constructor.
  • A Blade template of post/index.blade.php rendered by PostController@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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.