2017 © Pedro Peláez
 

library appskeleton-for-laravel

Custom artisan command for Laravel 5 to help speed up you web app development

image

fbnkcmaster/appskeleton-for-laravel

Custom artisan command for Laravel 5 to help speed up you web app development

  • Wednesday, July 6, 2016
  • by FBNKCMaster
  • Repository
  • 1 Watchers
  • 1 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

AppSkeleton-for-Laravel

AppSkeleton for Laravel is a custom artisan command that helps you speed up your application development by generating a ready structure (based on a json file) of files and direcories you'll need for your app, (*1)

Requirements

  • (Optional) If you need an advanced option to create migrations with schemas, you'll need to install laracasts/generators (by Jeffrey Way). If you use Composer to install this package, it's done automatically and you have to add its service provider in app/Providers/AppServiceProvider.php

Usage

Step 1: Install Through Composer

$ composer require fbnkcmaster/appskeleton-for-laravel

Step 2: Register the command

This is done within the app/Console/Kernel.php file, like so:, (*2)

protected $commands = [
    // add the line below to this array
    \FBNKCMaster\AppSkeletonForLaravel\AppSkeletonCommand::class
];
  • If you download and install it manually then you have to set the path/to/AppSkeleton/AppSkeletonCommand::class to register the command within the app/Console/Kernel.php file, like so:
protected $commands = [
    // add the line below to this array
    path/to/where/you/put/AppSkeleton/AppSkeletonCommand::class
];
  • Optional, (*3)

    You will need to install Jeffrey Way's laracasts/generators for more advanced option with migrations., (*4)

    Then add its service provider in app/Providers/AppServiceProvider.php, like so:, (*5)

public function register()
{
    if ($this->app->environment() == 'local') {
        $this->app->register('Laracasts\Generators\GeneratorsServiceProvider');
    }
}

Step 3: That's all!

You're ready now. Run php artisan from the console, and you'll see the new command make:appskeleton in the make:* namespace section., (*6)

Examples

Example of a json file

Put the json file whereever you can access it from the artisan command, (*7)

{
    "name": "App Name",
    "routes": [
        {"get": "/:function () {return view('welcome');}"},
        {"get": "home:HomeControler@index"},
        {"get": "users/{user}:UsersController@show"},
        {"post": "post:PostsController@store"},
        {"post": "comment:CommentsController@store"},
        {"resource": "post:PostsController"},
        {"resource": "comment:CommentsController"}
    ],
    "controllers": [
        {"name": "home"},
        {"name": "dashboard"},
        {"name": "users", "resource": false},
        {"name": "posts", "resource": true},
        {"name": "comments", "resource": true}
    ],
    "models": [
        {"name": "user"},
        {"name": "post", "migration": false},
        {"name": "comment", "migration": true}
    ],
    "migrations": [ // Jeffrey Way's laracasts/generators needed to take care of this, otherwise the schema is ignored and it will generate simple migrations files
        {"users_infos": "username:string, email:string:unique"},
        {"posts": "id:integer:unique, title:string"},
        {"comments": "id:integer:unique, post_id:integer:unique, text:string"}
    ],
    "views": ["home", "dashboard", "pages.users", "pages.posts", "pages.comments"],
    "assets": [
        {"sass": ["file1.sass", "file2.sass", "partials/subfile1.sass"]},
        {"js": ["file1.js", "file2.js", "plugins/file1.js", "plugins/file2.js"]}
    ],
    "publics": ["folder1", "folder2", "folder2/subfolder1", "folder2/subfolder2"]
}

Run commands

Generate everything in the json file (where AppSkeleton.json in the root of your Laravel application), (*8)

$ php artisan make:appskeleton

You can specify the path to your json file, (*9)

$ php artisan make:appskeleton path/to/your/appskeleton_file.json

Genereate just Controllers and Views, (*10)

$ php artisan make:appskeleton --controllers --views

Backup what was generated, (*11)

$ php artisan make:appskeleton [--controllers] [--views] --backup

Delete what was generated, (*12)

$ php artisan make:appskeleton [--controllers] [--views] --clear

Force delete generated files and directories even the backups, (*13)

$ php artisan make:appskeleton [--controllers] [--views] --clear --f

Available Arguments

path/to/file.json           set the json file that contains the structure of the app

Available Options

--routes                    parse routes
--controllers               parse controllers
--models                    parse models
--migrations                parse migrations
--views                     parse views
--assets                    parse assets
--publics                   parse publics
--routes                    parse routes
--b, --backup               make backup of generated files
--c, --clear                delete generated files
--f, --force                force delete generated files even backups

The Versions

06/07 2016

dev-master

9999999-dev

Custom artisan command for Laravel 5 to help speed up you web app development

  Sources   Download

MIT

The Requires

 

The Development Requires

by Farid BEN KACEM

laravel generator appskeleton

06/07 2016

1.0.0

1.0.0.0

Custom artisan command for Laravel 5 to help speed up you web app development

  Sources   Download

MIT

The Requires

 

The Development Requires

by Farid BEN KACEM

laravel generator appskeleton