Laravel 5.8.9 Released
Published on by Paul Redmond
The Laravel team released Laravel 5.8.9 this week, adding opt-in event discovery and the latest fixes and changes in the Laravel 5.8 release.
First, you should check out Taylor’s implementation and discussion around event discovery in PR #28064. Event discovery is an opt-in feature in Laravel 5.8, which means that you must explicitly define the following method in your EventServiceProvider
class, returning a Boolean true
:
/** * Determine if events and listeners should be automatically discovered. * * @return bool */public function shouldDiscoverEvents(){ return true;}
By default, the base Illuminate EventServiceProvider
returns false
by default in Laravel 5.8.
If you want to opt-in, you will probably want to cache the event discovery with the new artist event:cache
command. The discovery feature uses reflection to determine event listeners/handlers on the fly in development, but caching avoids that overhead in production. You can run this command via a composer script command event or somewhere in your build pipeline.
Taylor Otwell also discussed Event / Listener discovery in his podcast Laravel Snippet #10— you should give his podcast a listen.
You can see the full list of fixes below, and the whole diff between 5.8.8 and 5.8.9 on GitHub. The full release notes for Laravel 5.8 are available in the GitHub 5.8 changelog:
v5.8.9
Added
Fixed
- Fixed serializing a collection from a
Resource
withpreserveKeys
property (#27985) - Fixed:
SoftDelete::runSoftDelete
andSoftDelete::performDeleteOnModel
with overwrittenModel::setKeysForSaveQuery
(#28081)
Changed
- Update forever cache duration for database driver from minutes to seconds (#28048)
Refactoring:
- Refactoring of
Illuminate\Auth\Access\Gate::callBeforeCallbacks()
(#28079)