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 yourcomposer.json
.在
composer.json
需要"illuminate/workbench": "dev-master"
。// composer.json "require": { "laravel/framework": "5.0.*", "illuminate/workbench": "dev-master" }
Add
"workbench"
directory to yourautoload > classmap
array and runcomposer update
to reflect the changes.将
"workbench"
目录添加到您的autoload > classmap
数组中,然后运行composer update
以反映更改。// composer.json "autoload": { "classmap": [ "database", "workbench", "..." ] }
Create a
workbench.php
inside yourconfig
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 yourconfig/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/