快速提示:开发Laravel 5打包Laravel 4方式

Laravel 5 is out, and you may have noticed that the old package development procedure has changed. In this quick tip we will see how we can bring the joy of package development as it was before Laravel 5 to the latest release.

Laravel 5已经发布,您可能已经注意到旧的软件包开发过程已更改 。 在这个快速技巧中,我们将看到如何将Laravel 5之前的软件包开发的乐趣带到最新版本。

做Laravel 4种方式 (Doing it the Laravel 4 Way)

In this part we are going to load and configure the old method to work with Laravel 5. Follow the next steps to get started:

在这一部分中,我们将加载并配置可与Laravel 5一起使用的旧方法。请按照以下步骤开始:

  • Require "illuminate/workbench": "dev-master" in your composer.json.

    composer.json需要"illuminate/workbench": "dev-master"

    // composer.json
    	
    	"require": {
    		"laravel/framework": "5.0.*",
                    "illuminate/workbench": "dev-master"
    	}
  • Add "workbench" directory to your autoload > classmap array and run composer update to reflect the changes.

    "workbench"目录添加到您的autoload > classmap数组中,然后运行composer update以反映更改。

    // composer.json
    	
    	"autoload": {
            "classmap": [
                "database",
                "workbench",
                "..."
            ]
        }
  • Create a workbench.php inside your config folder and define your name and email.

    在您的config文件夹中创建一个workbench.php并定义您的姓名和电子邮件。

    // config/workbench.php
    	
    
    	return [
      		"name"    => "John Doe",
      		"email"   => "john@gmail.com"
    	];
  • add 'Illuminate\Workbench\WorkbenchServiceProvider', to your config/app.php providers.

    'Illuminate\Workbench\WorkbenchServiceProvider',添加到您的config/app.php提供程序中。

    // config/app.php
    	
    	"providers" => [
    		'...',
    		'Illuminate\Workbench\WorkbenchServiceProvider',
    	],

Now you are ready to follow the official Laravel 4 documentation.

现在,您可以按照官方的Laravel 4 文档进行操作

Creating packages has always been a part of our application development life cycle, so it makes sense to have a smooth way of doing so. Laravel 4 already had that part covered, and I hope that Laravel 5 will bring the workbench package back into the default installation.

创建软件包一直是我们应用程序开发生命周期的一部分,因此,有一种流畅的方法是有意义的。 Laravel 4已经涵盖了该部分,我希望Laravel 5可以将工作台软件包恢复到默认安装。

翻译自: https://www.sitepoint.com/quick-tip-develop-laravel-5-packages-laravel-4-way/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值