fbnkcmaster / appskeleton-for-laravel
Custom artisan command for Laravel 5 to help speed up you web app development
Requires
- php: >=5.5.9
- laracasts/generators: ~1.1.3
Requires (Dev)
- laravel/laravel: ~5.2.3
This package is not auto-updated.
Last update: 2024-11-09 20:12:21 UTC
README
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
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:
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
You will need to install Jeffrey Way's laracasts/generators for more advanced option with migrations.
Then add its service provider in app/Providers/AppServiceProvider.php, like so:
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.
Examples
Example of a json file
Put the json file whereever you can access it from the artisan command
{ "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)
$ php artisan make:appskeleton
You can specify the path to your json file
$ php artisan make:appskeleton path/to/your/appskeleton_file.json
Genereate just Controllers and Views
$ php artisan make:appskeleton --controllers --views
Backup what was generated
$ php artisan make:appskeleton [--controllers] [--views] --backup
Delete what was generated
$ php artisan make:appskeleton [--controllers] [--views] --clear
Force delete generated files and directories even the backups
$ 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