Laravel 5.8.17 Released With a “Tappable” Trait

Published on by

Laravel 5.8.17 Released With a “Tappable” Trait image

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)
Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Filed in:
Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Laravel Forge

Easily create and manage your servers and deploy your Laravel applications in seconds.

Visit Laravel Forge
Laravel Forge logo

Laravel Forge

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Forge
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $7500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $2500/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy
Lucky Media logo

Lucky Media

Bespoke software solutions built for your business. We ♥ Laravel

Lucky Media
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
LaraJobs logo

LaraJobs

The official Laravel job board

LaraJobs
Larafast: Laravel SaaS Starter Kit logo

Larafast: Laravel SaaS Starter Kit

Larafast is a Laravel SaaS Starter Kit with ready-to-go features for Payments, Auth, Admin, Blog, SEO, and beautiful themes. Available with VILT and TALL stacks.

Larafast: Laravel SaaS Starter Kit
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Rector logo

Rector

Your partner for seamless Laravel upgrades, cutting costs, and accelerating innovation for successful companies

Rector

The latest

View all →
Microsoft Clarity Integration for Laravel image

Microsoft Clarity Integration for Laravel

Read article
Apply Dynamic Filters to Eloquent Models with the Filterable Package image

Apply Dynamic Filters to Eloquent Models with the Filterable Package

Read article
Property Hooks Get Closer to Becoming a Reality in PHP 8.4 image

Property Hooks Get Closer to Becoming a Reality in PHP 8.4

Read article
Asserting Exceptions in Laravel Tests image

Asserting Exceptions in Laravel Tests

Read article
Reversible Form Prompts and a New Exceptions Facade in Laravel 11.4 image

Reversible Form Prompts and a New Exceptions Facade in Laravel 11.4

Read article
Basset is an alternative way to load CSS & JS assets image

Basset is an alternative way to load CSS & JS assets

Read article