Laravel Idea for PhpStorm - Full-featured IDE for productive artisans!

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
Cut PHP Code Review Time & Bugs into Half with CodeRabbit logo

Cut PHP Code Review Time & Bugs into Half with CodeRabbit

CodeRabbit is an AI-powered code review tool that specializes in PHP and Laravel, running PHPStan and offering automated PR analysis, security checks, and custom review features while remaining free for open-source projects.

Cut PHP Code Review Time & Bugs into Half with CodeRabbit
Join the Mastering Laravel community logo

Join the Mastering Laravel community

Connect with experienced developers in a friendly, noise-free environment. Get insights, share ideas, and find support for your coding challenges. Join us today and elevate your Laravel skills!

Join the Mastering Laravel community
Laravel Idea for PhpStorm logo

Laravel Idea for PhpStorm

Ultimate PhpStorm plugin for Laravel developers, delivering lightning-fast code completion, intelligent navigation, and powerful generation tools to supercharge productivity.

Laravel Idea for PhpStorm
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
Rector logo

Rector

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

Rector
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
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 →
Managing Request Host Information in Laravel image

Managing Request Host Information in Laravel

Read article
Tim Leland: URL Shorteners, browser extensions, and more image

Tim Leland: URL Shorteners, browser extensions, and more

Read article
HTTP Method Verification in Laravel image

HTTP Method Verification in Laravel

Read article
Packistry is a Self-hosted Composer Repository Made with Laravel image

Packistry is a Self-hosted Composer Repository Made with Laravel

Read article
Rector v2.0 image

Rector v2.0

Read article
How to document multiple APIs in Laravel with Scramble image

How to document multiple APIs in Laravel with Scramble

Read article