GithubHelp home page GithubHelp logo

larastart's Introduction

larastart

Larastart is a console application to bootstrap your Laravel App by generating Models, Migrations, Routes and API Controllers automatically. Proudly fueled by Laravel ^5.4 :)

Yep, that's right! An API out-of-the-box with a couples of console commands :)

Instalation

git clone https://github.com/ajaaleixo/larastart
cd larastart

Usage

To use it, you just need to provide a json file (+ formats to come) with the list of Resources that your application will need.

Larastart provides you several commands:

Available commands:
  help             Displays help for a command
  list             Lists commands
 make
  make:all         Wrapper to run all the other commands at once
  make:api         Generates API from a resource file
  make:migration   Generates Migrations from a resource file
  make:model       Generates Models from a resource file

You may use make:model , or any other command in separate, to generate your intended files:

php bin/larastart make:model examples/resources/blog.json ../output_dir
> Processing Models
> Generated 'post's model
> Generated 'author's model
> Finished

Resources File Format

A Resource is a standard file to describe your Data Model Structure, with validation rules. Those files should have an array of Resource Items. You may pass as a resource argument a file or a directory with resource files.

JSON

Each Resource file, is composed by Resource Items, that are described by:

  • name
  • description
  • model

A model is composed by:

  • columns: (Mandatory)
  • _softDeletes: (Optional) The common softDeletes of Laravel;
  • _timestamps: (Optional) The common timestamps of Laravel;
  • _table: (Optional) The table name. If not setted, resource.name will be used;
  • _{relationship type}: (Optional) Example "_hasOne": "author". You can provide a list of "hasOne" relations or a string for just one;

A column is composed by:

  • type: (Mandatory) All of the Laravel's column type. Ex: increments, integer, string, text, etc;
  • name: (Mandatory) The column name
  • length: (Optional) Used as column length in some of the available types;
  • _unsigned: (Optional) To describe a column as unsigned;
  • _index: (Optional) To add an index on this column. If a string is given it will be the index name. If boolean is given the index name will be automatically generated. If array of strings is given it will generate a compound index of the provided column names

Resource example for a Blog Application blog.json

larastart's People

Contributors

ajaaleixo avatar

Watchers

James Cloos avatar Emanuel Delgado avatar

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.