iwanli/

workbench

适用于 Laravel 5 的 workbench。

v0.15 2016-08-02 04:23 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:52:57 UTC


README

依赖于 https://github.com/pingpong-labs/workbench ,自定义目录并更新一些代码

安装

您可以通过运行以下命令通过 composer 命令行安装此包。

composer require iwanli/workbench

安装包后,将 Iwanli\Workbench\WorkbenchServiceProvider::class 添加到您的 config/app.php 文件中的 providers 数组中。

'providers' => [

  /*
   * Laravel Framework Service Providers...
   */
     ....

    Iwanli\Workbench\WorkbenchServiceProvider::class,

],

最后,通过运行以下命令发布包的配置

php artisan vendor:publish

这会将 workbench.php 配置文件发布到您的 config/ 文件夹,您需要在此设置包创建者的名称和电子邮件。

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Workbench Author Name
    |--------------------------------------------------------------------------
    |
    | When you create new packages via the Artisan "workbench" command your
    | name is needed to generate the composer.json file for your package.
    | You may specify it now so it is used for all of your workbenches.
    |
    */

    'name' => '',

    /*
    |--------------------------------------------------------------------------
    | Workbench Author E-Mail Address
    |--------------------------------------------------------------------------
    |
    | Like the option above, your e-mail address is used when generating new
    | workbench packages. The e-mail is placed in your composer.json file
    | automatically after the package is created by the workbench tool.
    |
    */

    'email' => '',
    /**
     * basic root directory name
     */
    'root_dir' => 'packages',

    /**
     * create directory in src
     */
    'support_directory' => [
        'config',
        'resources/lang',
        'migrations',
        'resources/views',
        'Facades'
    ]

];

自动加载 Workbench

您可以通过将以下命令添加到您的 bootstrap/autoload.php 文件中来自动加载 workbench。将此命令放在脚本的最底部。

/*
|--------------------------------------------------------------------------
| 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__.'/../packages'))
{
	Iwanli\Workbench\Starter::start($workbench);
}

创建一个包

在您创建包之前,您需要更新您的 config/workbench.php 文件中的 nameemail 配置值。

创建一个基本包。

php artisan workbench vendor/package

通过生成一些脚手架资源来创建一个包。

php artisan workbench vendor/package --resources