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.

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

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

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
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant 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
Supercharge Your SaaS Development with FilamentFlow: The Ultimate Laravel Filament Boilerplate logo

Supercharge Your SaaS Development with FilamentFlow: The Ultimate Laravel Filament Boilerplate

Build your SaaS application in hours. Out-of-the-box multi-tenancy and seamless Stripe integration. Supports subscriptions and one-time purchases, allowing you to focus on building and creating without repetitive setup tasks.

Supercharge Your SaaS Development with FilamentFlow: The Ultimate Laravel Filament Boilerplate
Rector logo

Rector

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

Rector
MongoDB logo

MongoDB

Enhance your PHP applications with the powerful integration of MongoDB and Laravel, empowering developers to build applications with ease and efficiency. Support transactional, search, analytics and mobile use cases while using the familiar Eloquent APIs. Discover how MongoDB's flexible, modern database can transform your Laravel applications.

MongoDB

The latest

View all →
Asymmetric Property Visibility in PHP 8.4 image

Asymmetric Property Visibility in PHP 8.4

Read article
Access Laravel Pulse Data as a JSON API image

Access Laravel Pulse Data as a JSON API

Read article
Laravel Forge adds Statamic Integration image

Laravel Forge adds Statamic Integration

Read article
Transform Data into Type-safe DTOs with this PHP Package image

Transform Data into Type-safe DTOs with this PHP Package

Read article
PHPxWorld - The resurgence of PHP meet-ups with Chris Morrell image

PHPxWorld - The resurgence of PHP meet-ups with Chris Morrell

Read article
Herd Executable Support and Pest 3 Mutation Testing in PhpStorm 2024.3 image

Herd Executable Support and Pest 3 Mutation Testing in PhpStorm 2024.3

Read article