Quick Tip: Develop Laravel 5 Packages the Laravel 4 Way
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.
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:
-
Require
"illuminate/workbench": "dev-master"
in yourcomposer.json
.// 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.// composer.json "autoload": { "classmap": [ "database", "workbench", "..." ] }
-
Create a
workbench.php
inside yourconfig
folder and define your name and email.// config/workbench.php return [ "name" => "John Doe", "email" => "john@gmail.com" ];
-
add
'Illuminate\Workbench\WorkbenchServiceProvider',
to yourconfig/app.php
providers.// config/app.php "providers" => [ '...', 'Illuminate\Workbench\WorkbenchServiceProvider', ],
Now you are ready to follow the official Laravel 4 documentation.
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.