jackiedo/workbench

Bring workbench back to Laravel 5.

5.4.5 2017-06-07 19:51 UTC

README

Latest Stable Version Total Downloads Latest Unstable Version License

Laravel 5 Workbench

Laravel 5 Workbench bring artisan workbench command (originally from Laravel 4.x) back to Laravel 5+. From now, you will not need to spend too much time building perfect structured packages for Laravel 5+. Let the Laravel 5 Workbench support you in every detail through it's powerful features.

Features

  • Build the standard structure for package.
  • Generate a standard composer.json file for package.
  • Generate a standard Service Provider file for package.
  • Generate some scaffold resources file, such as:
    • Facade files
    • Interface files
    • Abstract files
    • Exception files
    • Controller files
    • Middleware files
    • Model files
    • Artisan CLI files
    • Configuration file
    • Migration files
    • Language files
    • View files
    • Route file
    • Helper file
    • ...
  • Autoload dumping to be able to use your package immediately (after adding Service Provider of your package into providers section in config/app.php file).

Overview

Look at one of the following topics to learn more about Laravel 5 Workbench

Versions and compatibility

Each branch of Laravel 5 Workbench is similarities with each version of Laravel 5+. Example:

Branch Laravel version
5.0 5.0
5.1 5.1
5.2 5.2
5.3 5.3
5.4 5.4

In each branch we have multiple versions, tagged syntax as 5.0.*, 5.1.*, 5.2.*, 5.3.*, 5.4.*...

Installation

You can install this package through Composer.

  • First, edit your project's composer.json file to require jackiedo/workbench:
...
"require": {
    ...
    "jackiedo/workbench": "{{laravel-version}}.*"
},

Note: {{laravel-version}} string above is main version of Laravel that you want to install Laravel Workbench on it. Example, if you want to install this package on Laravel 5.4, you have to set require is "jackiedo/workbench": "5.4.*"

  • Next step, we update Composer from the Terminal on your project source:
$ composer update
  • Once update operation completes, on the third step, we add the service provider. Open config/app.php file, and add a new item to the providers array:
...
'providers' => array(
    ...
    Jackiedo\Workbench\WorkbenchServiceProvider::class,
),
  • On the fourth step, we publish configuration file:
$ php artisan vendor:publish --provider="Jackiedo\Workbench\WorkbenchServiceProvider" --force

Note: You should use --force option in publish command to override configuration file with newest one.

  • And the final step is add autoload the workbench to your bootstrap/autoload.php file. Put this following code at the very bottom of script.
/*
|--------------------------------------------------------------------------
| Register The Workbench Loaders
|--------------------------------------------------------------------------
|
| The Laravel workbench provides a convenient place to develop packages
| when working locally. However we will need to load in the Composer
| auto-load files for the packages so that these can be used here.
|
*/

if (is_dir($workbench = __DIR__.'/../workbench'))
{
    Jackiedo\Workbench\Starter::start($workbench);
}

Usage

Now, you can use workbench commands to create your packages same as on Laravel 4.2.

Note: Before you create a package, you need to update name and email config value in your config/workbench.php file.

Creating a basic package.

$ php artisan workbench vendor/name

Creating a package with generating some scaffold resources.

$ php artisan workbench vendor/name --resources

Screenshot

Create package without generating scaffold resources.

create-without-resources result-without-resources

Create package with generating scaffold resources.

create-with-resources result-with-resources

Create package with generating scaffold resources and point PSR-4 autoloading namespace to the src directory.

create-with-point-namespace-to-src-dir result-with-point-namespace-to-src-dir

Configuration

All details are provided in your config/workbench.php as comments (you have to run Artisan vendor:publish command before). Please read carefully before use.

Other documentation

For more documentation about package development, you can visit Official Laravel Documentation pages: