Intermediate

What's New in Laravel 5.5

whatsnewinlaravel.com

Here we go again! Currently scheduled for an August release date, we're on the verge of Laravel 5.5. With that in mind, let's get a head start on the new features and additions to the framework. As always, there's quite a few!

Start Series

Share this series on:

  • 01

    Episode 1 Run Time 1:19

    Laravel 5.5 Installation and Whoops Free

    Let's get started by installing, at the time of this recording, the development version of Laravel. That way, we can pull in the 5.5 version of the framework. Once setup, we'll also take a quick look at the new Whoops integration.

  • 02

    Episode 2 Run Time 5:42

    Streamlined Request Validation Free

    A small, but long-requested addition, you may now send a validate message directly on your Request instance. Even better, this method call will return the validated data, which means you can pass the result directly to your model's create or update methods. Simpler code for the win!

  • 03

    Episode 3 Run Time 1:04

    Fresh Migrations Free

    A new migrate:fresh Artisan command is being introduced as part of Laravel 5.5. This is similar to the existing refresh option, however, rather than rolling back all of your migrations (and triggering the respective down method for each), this new command will simply drop all tables and run your migrations from scratch.

  • 04

    Episode 4 Run Time 3:28

    Frontend Presets Free

    Out of the box, Laravel ships with a small bit of frontend boilerplate to get you up and running as quickly as possible. Specifically, it includes a few Sass and Vue suggestions. However, as part of Laravel 5.5, you may now configure this initial boilerplate to your liking. Want to strip all of it? Now you can. Prefer to use React instead of Vue? Easy!

  • 05

    Episode 5 Run Time 2:51

    Automatic Package Discovery Free

    If you've ever installed a Laravel package before, you most certainly were required to visit your `config/app.php` file to add a service provider and alias. This is what allows the package to bootstrap itself into your Laravel installation. In Laravel 5.5, however, packages can optionally perform these steps automatically. In this video, we'll update an existing Laracasts package to allow for this very thing.

  • 06

    Episode 6 Run Time 3:20

    Faster Email Layout Testing Free

    Testing the layout of your mailables can always be a little tricky. Usually, we resort to sending the email to a test email server like Mailtrap, and then reviewing the output. In Laravel 5.5, however, we can now return a mailable class instance directly from any route. Convenient!

  • 07

    Episode 7 Run Time 5:21

    Silky Smooth Custom Validation Rules Free

    In Laravel 5.5, you'll find a brand new App/Rules folder. The next time you require custom logic for a particular request attribute, you'll laugh at how simple it now is.

  • 08

    Episode 8 Run Time 3:07

    Collection Dumping Free

    Debugging a complex collection pipeline can get a little tricky. Often, you'll find yourself temporarily commenting out portions of code, as you confirm the dumped output. In Laravel 5.5, however, you'll find two new helper methods on your collection instances: dump() and dd().

  • 09

    Episode 9 Run Time 1:51

    Model Factory Generation Free

    In Laravel 5.4, all model factories were contained within a single file. Need to construct a new factory? Well, you know the drill: copy and paste the one before it, and make your changes. Luckily though, in 5.5, there's a simpler way. Each of your Eloquent models will now have a respective model factory file.

  • 10

    Episode 10 Run Time 3:50

    Custom Blade "If" Directives Free

    In Laravel 5.5, you'll find a sweet new syntax for defining custom if Blade directives. Want a useful @subscriber directive to conditionally load HTML for only the subscribers of your site? It's so easy! Give me a few moments, and I'll show you how.

  • 11

    Episode 11 Run Time 12:15

    What's New in Laravel Mix

    Though Mix is entirely separate from Laravel 5.5, you will find a bump to version 1.0 in your package.json file. In this video, we'll review a few new additions, including updated versioning, sequential custom tasks, fast Sass compilation, CSS purification, and more.

  • 12

    Episode 12 Run Time 2:12

    Auto-Registering Artisan Commands Free

    In Laravel 5.5, you'll no longer be required to manually register your Artisan commands. The framework will instead automatically scan the commands folder for you. The means you may now run php artisan make:command FooCommand, and then immediately trigger it. Useful!

  • 13

    Episode 13 Run Time 8:12

    Higher Order Tap Free

    The tap() helper function has now been supercharged to be even more flexible. You may omit the closure second argument to this function, in which case a proxy class will be returned. This proxy will properly delegate to any method you call from that point forward, while returning your original value per usual. It sounds a bit confusing on paper, but you'll get a lot of use out of this one.

    Please note that this update to tap() is also available in fresh 5.4 installs.

  • 14

    Episode 14 Run Time 5:54

    The RefreshDatabase Trait Free

    In previous versions of Laravel, you were presented with two database-specific traits for your test classes: DatabaseTransactions and DatabaseMigrations. While it doesn't take too much work to understand the difference between the two, nonetheless, it could be confusing to newcomers. "Wait, which one am I supposed to use to reset my database? Which is better?" In Laravel 5.5, all of this has been streamlined (though these traits are still available for backward compatibility). You'll now find a single RefreshDatabase trait that automatically figures out which DB reset strategy to use.

  • 15

    Episode 15 Run Time 2:31

    New Blade Directives Free

    Laravel offers two new useful Blade directives as part of version 5.5: @auth and @guest. They do exactly what you'd imagine, so say goodbye to the constant @if (auth()->check()).

  • 16

    Episode 16 Run Time 2:08

    Route Helpers Free

    You may now use the helpful Route::view() and Route::redirect() helpers within your routes.php file. Think of these as shorthand for loading a view and performing a redirect, respectively.

  • 17

    Episode 17 Run Time 5:39

    Toggle Exception Handling Within Your Tests Free

    When writing tests for your application, you may encounter situations when you don't want Laravel to automatically catch and transform an exception. You can now disable exception handling on a test-by-test basis, via the $this->withoutExceptionHandling() method call.

  • 18

    Episode 18 Run Time 5:03

    Cleaner Exception Rendering Free

    When an exception is thrown in your app, you can optionally let it bubble up to app/Exceptions/Handler.php. Here, you may type-check the exception to determine the appropriate response to return. While this is certainly useful, over the lifetime of a project, you'll notice that this method grows and grows.

    A more object-oriented approach would be to allow the exception to determine how to render itself. And now, in Laravel 5.5, you can do that very thing.

  • 19

    Episode 19 Run Time 4:33

    Optional Objects Free

    Laravel 5.5 includes a new helper() function, which you can think of as a generic null object implementation. Have you ever run into the situation where you need to fetch a property from a relationship, but it's possible that the relationship itself returns null? Well now we have a cleaner way to do this.

  • 20

    Episode 20 Run Time 11:24

    API Resources Free

    In Laravel 5.5, resource classes allow you to transform your Eloquent models into the proper JSON data structure. Though you can of course override the toArray() method on your models to allow for this, when building an API that you intend to expose to potentially millions of users, it's important to codify this structure and response format as reliably and consistently as you can.

*Series still in development. Check back often for updates.