10 Must-have Laravel 5.1 Packages

Access all tutorials in sprocket icon.

June 25, 2015 from author Bill Keck.

I’m going to be doing a fairly long tutorial on image management and it occurred to me that it would be helpful if people who want to follow that tutorial had the intervention/image package installed because we are going to be using it. That got me thinking it might be nice to share some common packages that we would typically install in our Laravel 5.1 build.

Just a quick recap for anyone who is unfamiliar with packages and composer. I’m assuming that if you are using Laravel, you have installed composer and have a development environment setup. If you haven’t done this yet, please refer to my development environment tutorial, which comes with links for easy reference.

Ok, so if you have some experience with composer, you know that it makes installing 3rd party packages for Laravel a snap. You can find an amazing selection of Laravel packages at Packagist.org. I set the link to search for packages tagged for Laravel.

If you look at the number of downloads per package, obviously you can tell which ones are the most popular.

Here are 10 that I use for a typical fresh build of Laravel 5.1.

  1. laravelcollective/html
  2. barryvdh/laravel-debugbar
  3. patricktalmadge/bootstrapper
  4. cviebrock/eloquent-sluggable
  5. doctrine/dbal
  6. laracasts/generators
  7. laracasts/flash
  8. barryvdh/laravel-ide-helper
  9. creativeorange/gravatar
  10. intervention/image

If you want to pull them in through composer, you can add them to your require block in your composer.json file:

         "laravelcollective/html": "~5.0",
         "barryvdh/laravel-debugbar": "~2.0",
         "patricktalmadge/bootstrapper": "~5",
         "cviebrock/eloquent-sluggable": ">=3.0.0-alpha",
         "doctrine/dbal": "2.5.0",
         "laracasts/generators": "~1.1",
         "laracasts/flash": "~1.3",
         "barryvdh/laravel-ide-helper": "~2.0",
         "creativeorange/gravatar": "~1.0",
         "intervention/image": "~2.2"

Then run composer update. You can find instructions for each install in the links in the ordered list above. Typically, all you have to do is configure the config/app.php providers and aliases arrays. It really is super-simple, which is why everyone loves composer and Laravel’s application architecture.

I’m not listing the actual instructions here because I think it’s important that you get used to pulling that info from the source. There’s no way I can stay on top of all the updates and there’s no sense in duplicating information. I will of course add any special notes when appropriate.

Ok, so let’s briefly describe each one:

1. laravelcollective/html

This one replaces the illuminate/html class, since that class is no longer supported and is no longer included in the core as of laravel 5. This package is essential, if you like using the form model binding like so:

{!! Form::model($marketingImage, ['route' => ['marketingimage.destroy', $marketingImage->id],
        'method' => 'DELETE',
        'class' => 'form',
        'files' => true]
        ) !!}

But obviously this is not completely necessary, which is why it’s no longer in the core. You could simply create a form manually using bootstrap. You just have to remember to add:

 <input type="hidden" name="_token" value="{{ csrf_token() }}">

That will add your csrf token to the post data.

So obviously, using the Form helper does this for you, which is why I use it when I can. I find it very convenient.

When you are installing this, you will see instructions for adding the ‘Form’ alias. Please note that the bootstrapper package has Form alias as well and you cannot use both, because it will cause a conflict. So I solved this by simply not including the alias for the bootstrapper form alias.

Also note: Most instructions for adding to providers array and the alias array are not using the new PHP ::class syntax. I recommend using the new syntax, which is better to use because you can use your IDE to click into the class.

So for example, old style alias:

'Form'  => 'Collective\Html\FormFacade',

New style:

'Form'  => Collective\Html\FormFacade::class,

You can do the same for the providers, in this case it’s the html provider:


2. barryvdh/laravel-debugbar

This is an absolute must for development. It installs a debug bar that sits at the bottom of the page that gives you helpful information on routes, DB queries and more.

3. patricktalmadge/bootstrapper

This is a pretty wrapper for a lot of bootstrap stuff. I haven’t gone too far deep into it, but I do use the breadcrumb widget. As I noted in the laravel collective html package, there is a conflict with the form alias, so leave that one out when you are updating the aliases array in config/app.php.

4. cviebrock/eloquent-sluggable

This is a very robust package for adding slugs to your url.

5. doctrine/dbal

We need this package in order to run migration:rollback. I had trouble installing this until I figured out the correct way to add it to composer.json, which I’ve given you above.

6. laracasts/generators

This one gives us an artisan command for creating pivot table migrations.

7. laracasts/flash

This is a nice handy helper to make your flash message syntax in your controller beautiful:

flash()->success('Marketing Image Created!');

8. barryvdh/laravel-ide-helper

This installs a helper class, which helps PhpStorm recognize your laravel classes, so you don’t end up with unnecessary error messages from your IDE. This one doesn’t need configuration in config/app.php. Instead, you have to initialize from artisan commands.

9. creativeorange/gravatar

This is a super-simple gravatar package that lets you display the users gravatar.

10. intervention/image

This is a very handy image helper class that lets you do things like save thumbnails of the image, set it as grayscale if you choose, and a whole lot more. Working with images is kind of a pain, and any help with syntax is worth it.

This group of packages will help you with my tutorials if you want to follow along. You can also view all of my tutorials for Laravel by clicking on the sprocket at the top of the page.

I hope you have enjoyed this tutorial and found it useful. Click on the sprocket icon at the top of the page to see all tutorials. Please comment, share, and like if you can, thanks.

I don’t have a donate button, but If you would like to support my work, you can do so by buying one of my 99¢ books, I really appreciate it.