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'); // Previouslydd($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:
# Previouslyphp artisan route:list --columns=method --columns=uri --columns=name # Nowphp artisan route:list --columns=method,uri,namephp 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_withvalidation rule (#28455) - Added possibility to use a few
columnsarguments in theroute:listcommand (#28459) - Added
retryAfterinMail\SendQueuedMailableandNotifications\SendQueuedNotificationsobject (#28484) - Added
Illuminate\Foundation\Console\Kernel::scheduleCache()(6587e78) - Added support for multiple
--pathoptions within migrate commands (#28495) - Added
Tappabletrait (#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
PhpRedisConnectionandPredisConnection(f4e8d5c)
Fixed
- Fixed session resolver in
RoutingServiceProvider(without bind ofsessioninContainer) (#28438) - Fixed
route:listcommand when routes were dynamically modified (#28460, #28463) - Fixed
requiredvalidation with multiplepasses()calls (#28502) - Fixed the collation bug when changing columns in a migration (#28514)
- Added password to the
RedisClusteronly ifredis>=4.3.0(1371940) - Used
escapeshellargon windows symlink inFilesystem::link()(44c3feb)
Changed
- Reset webpack file for none preset (#28462)