Creating a Composer package in Laravel
Using Laravel's Workbench, we can easily create a package that can be used and installed by Composer. We can also add functionality so that the package integrates seamlessly into our Laravel app. In this recipe, we'll be creating a simple package that will display a list of Vimeo videos for a specified user.
Getting ready
For this recipe, we'll need a standard Laravel installation.
How to do it…
To complete this recipe, follow these steps:
In the
app/config
directory, open theworkbench.php
file and update it with the following information:<?php return array( 'name' => 'Terry Matula', 'email' => 'terrymatula@gmail.com', );
In the command line, use artisan to set up our package:
php artisan workbench matula/vimeolist --resources
Find the directory that will hold our source files and create a file named
Vimeolist.php
. In this example, we would put the file inworkbench/matula/vimeolist/src/Matula/Vimeolist/
:<?php namespace Matula\Vimeolist...