GithubHelp home page GithubHelp logo

adrorocker / canvas Goto Github PK

View Code? Open in Web Editor NEW

This project forked from orchestral/canvas

0.0 1.0 0.0 252 KB

Code Generators for Laravel Applications and Packages

Home Page: https://packagist.org/packages/orchestra/canvas

License: MIT License

Shell 0.97% PHP 99.03%

canvas's Introduction

Code Generators for Laravel Applications and Packages

Canvas replicates all of the make artisan commands available in your basic Laravel application. It allows everyone to use it:

  • outside of Laravel installation such as when building Laravel packages.
  • with Laravel by allowing few customization to the stub resolved class and namespace.

Build Status Latest Stable Version Total Downloads Latest Unstable Version License Coverage Status

Installation

To install through composer, run the following command from terminal:

composer require --dev "orchestra/canvas"

Usages

As a Laravel developer, you should be familiar with the following commands:

Command. Description
make:channel Create a new channel class
make:command Create a new Artisan command
make:controller Create a new controller class
make:event Create a new event class
make:exception Create a new custom exception class
make:factory Create a new model factory
make:job Create a new job class
make:listener Create a new event listener class
make:mail Create a new email class
make:middleware Create a new middleware class
make:migration Create a new migration file
make:model Create a new Eloquent model class
make:notification Create a new notification class
make:observer Create a new observer class
make:policy Create a new policy class
make:provider Create a new service provider class
make:request Create a new form request class
make:resource Create a new resource
make:rule Create a new validation rule
make:seeder Create a new seeder class
make:test Create a new test class

Which can be execute via:

php artisan make:migration CreatePostsTable --create

With Canvas, you can run the equivalent command via:

./vendor/bin/canvas make:migration CreatePostsTable --create

canvas.yaml Preset file

To get started you can first create canvas.yaml in the root directory of your Laravel project or package.

Laravel preset

You can run the following command to create the file:

./vendor/bin/canvas preset laravel

Which will output the following as canvas.yaml:

preset: laravel

namespace: App

model:
  namespace: App

Package preset

You can run the following command to create the file:

./vendor/bin/canvas preset package

Which will output the following as canvas.yaml:

preset: package

namespace: PackageName
user-auth-provider: App\User

paths:
  src: src
  resource: resources

factory:
  path: database/factories

migration:
  path: database/migrations
  prefix: ''

console:
  namespace: PackageName\Console

model:
  namespace: PackageName

provider:
  namespace: PackageName

testing:
  namespace: PackageName\Tests

You need to change PackageName to the root namespace for your package.

Alternatively, you can set --namespace option to ensure the namespace is used in the file:

./vendor/bin/canvas preset package --namespace="Foo\Bar"
preset: package

namespace: Foo\Bar
user-auth-provider: App\User

paths:
  src: src
  resource: resources

factory:
  path: database/factories

migration:
  path: database/migrations
  prefix: ''

console:
  namespace: Foo\Bar\Console

model:
  namespace: Foo\Bar
  
provider:
  namespace: Foo\Bar

testing:
  namespace: Foo\Bar\Tests

Integration with Laravel

By default, you can always use ./vendor/bin/canvas for Laravel and Packages environment. However, with the Package Discovery Orchestra\Canvas\LaravelServiceProvider will be installed automatically and override all default make command available via artisan so you can use it without changing anything.

canvas's People

Contributors

crynobone avatar

Watchers

 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.