A workbench is a project dedicated for creating all your packages.
The first step that needs to be taken, is cloning Laravel. Go to your code directory and run
git clone firstname.lastname@example.org:laravel/laravel.git. Your workbench directory will now be called
laravel. The location of my workbench is
Within your workbench you need a directory for your packages. We are going to use this directory to autoload the packages you are creating. For your package you can create directories with the following structure:
packages/[Vendor]/[Package]/src. This could result in
Navigate to you package (
packages/Captain/Awesome/src) and run
composer init. You will be asked several questions, answer them, and add the dependencies you need.
Now it’s time to create the bootstrapper of your package, the ServiceProvider. Place it in the
src/ directory of your plugin. You can find more information about it in the docs. Most of the time, people use the name of their plugin +
ServiceProvider. So in our example, it will be
Autoload your package
Now your plugin needs to be autoloaded, like all the files in
vendor/. You can do that by adding the
packages/ folder to the composer.json of your workbench.
Add your ServiceProvider to config/app.php
Now we need to add our package to the Laravel workbench project. We can do that by adding our
config/app.php. It will look like this:
* Package Service Providers...
I got my information from a clear topic on Laracasts. But I saw the post was old, so I checked if it still works, and wrote about it in this article.
Hope this will help you with your package development. I tried to test it the best I could, so I hope you won’t have any problems with this guide. Otherwise, let me know!
Happy coding! :)