Every two weeks I send out a newsletter containing lots of interesting stuff for the modern PHP developer. You can expect quick tips, links to interesting tutorials, opinions and packages. Want to learn the cool stuff? Then sign up now!

Packages that make developing Laravel apps easier

In this post I’d like to share some of the packages that make developing a Laravel app easier.

laravel-debugbar

This package really needs no introduction as it is one of the most popular packages around. It’s made by Barry Vd. Heuvel and it’s a real powerhouse. Once the package is installed it displays a debugbar in your browser that shows a lot of useful info such as the executed queries, which views are used, which controller built up the page, and much much more.

https://github.com/barryvdh/laravel-debugbar

laravel-ide-helper

This package, also made by Barry, can generate some files that help an IDE provide improved autocompletion. Using this package PHPStorm can autocomplete methods on facades, classes resolved out of the container and model properties.

https://github.com/barryvdh/laravel-ide-helper

laravel-tail

Those who are already using Laravel for quite some time know that Laravel 4 provided an artisan command to tail the Laravel default log. Unfortunately in Laravel 5 that command was axed. This package brings it back.

With the package installed you can just run php artisan tail to tail the log.

https://github.com/spatie/laravel-tail

laravel-mailable-test

Laravel 5.3 introduced mailables. A mailable is a class that takes care of everything regarding sending a mail.

One of the things that is not so easy to in a vanilla Laravel app is testing such a mail. In order to for example let your app send an order confirmation mail you have to go through the entire checkout process. The laravel-mailable-test package can make the mailable testing process a lot easier. It provides an artisan command that can send a mailable to a specific mail address.

The package will provide a value for any typehinted argument of the constructor of the mailable. If an argument is a int, string or bool the package will generated a value using Faker. Any argument that typehints an Eloquent model will receive the first record of that model.

If you want to learn more, read this introductory blog post about it.

https://github.com/spatie/laravel-mailable-test

laravel-mail-preview

Made by Mohamed Said, this package can help you test a flow where mail is involved. Instead of sending the actual mail that package will save the mail to the filesystem. In the browser it will display a little notice that a mail was sent. Clicking on the link in that notice will display the saved mail right in your browser.

Here’s a short movie clip that shows how it can be used to test a password reset.

https://github.com/themsaid/laravel-mail-preview

laravel-migrate-fresh

In my projects I have never run a down migration. So I don’t bother with coding up the down steps. And without those down steps running Laravel’s migrate:refresh will result in errors. If you think skipping writing down steps is lazy, read this comment Adam Wathan made on Reddit.

The laravel-migrate-fresh package provides an artisan command that can knock out all your tables without using down steps of a migration.

https://github.com/spatie/laravel-migrate-fresh


Do you know some other indispensable package that makes developing a Laravel app easier? Let me know in the comments below.

Freek Van der Herten is a partner and developer at Spatie, an Antwerp based company that specializes in creating web apps with Laravel. After hours he writes about modern PHP and Laravel on this blog. When not coding he’s probably rehearsing with his kraut rock band.
  • I may be a little biased (I made the packages ;-)), but I find myself always including Artisan View ( https://github.com/svenluijten/artisan-view ) and Env Providers ( https://github.com/svenluijten/env-providers ) in every Laravel app I set up.

    • Those are nice little packages for conveniences. Nice work.

  • Robert Clancy

    debugbar is like using firebug in chrome, wish people would stop promoting it

  • Jarek
  • Sohel Amin

    Maybe you missed the CRUD Generator https://github.com/appzcoder/crud-generator

  • Juan Eugenio Abadie

    For bash users, this package can save you a lot of typing: https://github.com/whoan/laravel-bash-helpers

  • orrd

    As an alternative to using laravel-debugbar, you should at least consider using Clockwork (https://github.com/itsgoingd/clockwork) instead. It takes an extra step in that you have to install a browser extension (for Chrome, Firefox, etc.), but the big advantage is that it works will *all* types of responses from your app, not just HTML pages. So it works with API calls, etc. It also doesn’t insert Javascript/HTML into your page as laravel-debugbar does, which can cause issues in some cases.

    • Dave Y.

      Totally agree.

  • Andreas Herss

    A package that i enjoy too is https://github.com/garygreen/pretty-routes
    It’s especially good as i am writing all route and backend logic, and my coworker is doing the frontend.

    With this package he can easily see all the routes i have defined, their name and HTTP type and what parameters i require from him.

    • Sebastiaan

      That’s neat! And extremely useful for front-end indeed. Adding it to my base project repo for future projects.

  • Pingback: PHPWeekly February 16th 2017 - Nima habibkhoda official Blog()

  • Sebastiaan

    In every project, at least:

    – graham-campbell/exceptions + filp/whoops for exceptions
    – nesbot/carbon for time and date operations
    – nwidart/laravel-modules to separate logic and keep everything tidy
    – sebastiaanluca/laravel-conditional-providers to load service providers basic on environment (required to counter exceptions when e.g. ide-helper is registered with the other providers)
    – sebastiaanluca/laravel-helpers
    – sebastiaanluca/laravel-router
    – sebastiaanluca/laravel-unbreakable-migrations
    – sebastiaanluca/laravel-validator
    – spatie/laravel-backup 😉

    And dev packages:

    – kint-php/kint for better debug traces
    – hannesvdvreken/guzzle-debugbar
    – laravel/envoy to deploy the project
    – laravel/homestead for per-project VM
    – spatie/laravel-db-snapshots to save local databases when messing around

    Part of https://github.com/sebastiaanluca/laravel-skeleton-5.4 (easier to start a new project by just cloning it).