Laravel 5.8.17 Released With a “Tappable” Trait

Laravel 5.8.17 Released With a “Tappable” Trait

The Laravel team released Laravel 5.8.17 yesterday with a new Tappable trait, a dumpHeaders test method, and quite a few other new features.

First, a new dumpHeaders() method was added to the TestResponse class which helps you debug headers. Here’s the improvement over doing this manually:

$response = $this->get('/example');

// Previously
dd($response->headers->all());

// Ah, that's better
$response->dumpHeaders();

The new dumpHeaders method PR mentioned the dump() method, which you might not be familiar with but is also convenient:

// dd() the response content...
$response->dump();

Next, an ends_with validation rule was added, which looks like this:

$rules = [
    'email' => 'required|ends_with:laravel.com,jasonmccreary.me',
];

Next, support for multiple columns arguments got added to the route:list command:

# Previously
php artisan route:list --columns=method --columns=uri --columns=name

# Now
php artisan route:list --columns=method,uri,name
php artisan route:list --columns=method --columns=uri,name

A new Tappable trait was added to Illuminate\Support which you can define on a class like so:

use Illuminate\Support\Traits\Tappable;

class TappableClass {
    use Tappable;
    // ...
}

Here’s a before and after example:

// with tap method
$result = tap(TappableClass::make(), function ($tappable) {
    $tappable->doSomething();
    $tappable->doSomethingElse();
})->getResult();

// with Tappable trait
$result = TappableClass::make()->tap(function ($tappable) {
    $tappable->doSomething();
    $tappable->doSomethingElse();
})->getResult();

You can see the full list of fixes below, and the whole diff between 5.8.16 and 5.8.17 on GitHub. The full release notes for Laravel 5.8 are available in the GitHub 5.8 changelog:

v5.8.17

Added

  • Added Illuminate\Foundation\Testing\TestResponse::dumpHeaders() (#28450)
  • Added ends_with validation rule (#28455)
  • Added possibility to use a few columns arguments in the route:list command (#28459)
  • Added retryAfter in Mail\SendQueuedMailable and Notifications\SendQueuedNotifications object (#28484)
  • Added Illuminate\Foundation\Console\Kernel::scheduleCache() (6587e78)
  • Added support for multiple --path options within migrate commands (#28495)
  • Added Tappable trait (#28507)
  • Added support auto-discovery for events in a custom application directory, that sets via Illuminate\Foundation\Application::useAppPath() (#28493)
  • Added passing of notifiable email through reset link (#28475)
  • Added support flush db on clusters in PhpRedisConnection and PredisConnection (f4e8d5c)

Fixed

  • Fixed session resolver in RoutingServiceProvider (without bind of session in Container) (#28438)
  • Fixed route:list command when routes were dynamically modified (#28460, #28463)
  • Fixed required validation with multiple passes() calls (#28502)
  • Fixed the collation bug when changing columns in a migration (#28514)
  • Added password to the RedisCluster only if redis >= 4.3.0 (1371940)
  • Used escapeshellarg on windows symlink in Filesystem::link()(44c3feb)

Changed

  • Reset webpack file for none preset (#28462)

Filed in: News

Newsletter

Join 31,000+ others and never miss out on new tips, tutorials, and more.

Laravel News Partners

Laravel Jobs

Laravel Senior Developer
Remote, Canada Only
BeMo Academic Consulting
Senior Fullstack Developer / Architect (w/m/d)
Remote / Munich - Germany
envivo.select GmbH
Medior full stack developer (Laravel)
Deventer (or remote) in the Netherlands, Dutch speaking required.
MSML B.V.
Senior Full Stack PHP Developer (Laravel)
Remote
MAPPEN
Senior Laravel Developer
Remote
ACTO