X
    Categories: Database Tutorials, Tips and GuidesLearn Laravel Tutorials, Tips And GuidesLearn PHP Tutorials, Tips And Guides

New Features in Laravel 5.4: Laravel Dusk, Markdown Mail & Redis Cluster

Laravel was the top PHP framework in 2016 and this trend will remain strong in 2017 because of the latest release of Laravel 5.4. Like the previous versions (particularly Laravel 5.3) of Laravel, this latest version comes with new and improved features including support of markdown, Laravel Dusk and improvements in Redis clustering.

The excitement of the community could be judged from the official tweet:

Important Features in Laravel 5.4

Laravel 5.4 introduces important changes and updates to almost all areas of the framework. In particular, this update changed:

Laravel Dusk

Laravel Dusk is an end-to-end testing tool for testing Javascript powered page interactions (for instance, button and link clicks) within the application. Dusk is based on ChromeDriver and allows you to write tests that checks application flow in the browser. For instance, you could check whether the user is redirected to the homepage after successful login. Check out the official documentation for more information about Dusk.

Related: Introduction To Laravel Dusk: Testing Todo App

Markdown Mail & Notification

Laravel 5.4 comes with pre-built markdown templates and components for mail and notifications. Laravel 5.4 powered apps could now generate responsive HTML emails. Learn more about markdown in Laravel mail and notification documentations.

Laravel Mix

Introduced for the first time in Laravel 5.4, Laravel Mix is the successor of Elixir API. In contrast to Gulp based Elixir, Mix is based on Webpack.

“Realtime” Facades

In Laravel 5.4, you can easily convert your application class into a facade. Previously, you could only use built-in facades in your application. Learn more about this feature here.

Redis Cluster Support

In previous versions of Laravel, clustering of the single host in the same application was not possible. In Laravel 5.4, you can now define Redis connections to multiple single hosts and multiple clusters within the same application.

Collections Support Higher Order Messages

Collections now support higher order messages (shortcuts for performing common actions on collections). Methods that support higher order messages are: contains, each, every, filter, first, map, partition, reject, sortBy, sortByDesc, and sum.

In addition to the above, Laravel 5.4 has introduced a host of features that will greatly ease the process of application development using the framework.

Related: Getting Started With Laravel 5.4

Laravel 5.4 Changelog

Several important entries on Laravel 5.4 changelog along with appropriate pull requests are:

General

  • Added real-time facades (feb52bf)
  • Added retry() helper (e3bd359, 52e9381)
  • Added array_wrap() helper function (0f76617)
  • Added default 503 error page into framework (855a8aa, #16848)
  • Removed compiled class file generation and deprecated ServiceProvider::compiles() (#17003, 733d829)
  • Renamed DetectEnvironment to LoadEnvironmentVariables (c36874d)

Authentication

  • Secured password reset tokens against timing attacks and compromised databases (#16850, 9d674b0)
  • Refactored authentication component (7b48bfc, 5c4541b)
  • Added names to password reset routes (#16988)
  • Stopped touching the user timestamp when updating the remember_token (#17135)

Blade

Cache

  • Added RedisStore::add() to store an item in the cache if the key doesn’t exist (#15877)
  • Added cache:forget command (#16201, 7644977)
  • Refactored cache events (b7454f0, #17120)
  • Cache::flush() now returns boolean (#15831, 057492d)

Console

  • Added –model to make:controller command to generate resource controller with type-hinted model (#16787)
  • Require confirmation for key:generate command in production (#16804)
  • Added ManagesFrequencies trait (e238299)
  • Added Queueable to queued listener stub (dcd64b6)
  • Changed namespace generation in GeneratorCommand (de9e03d)
  • Added Command::$hidden and ScheduleFinishCommand (#16806)
  • Moved all framework command registrations into ArtisanServiceProvider (954a333, baa6054, 87bd2a9)
  • Support passing output buffer to Artisan::call() (#16930)

The complete changelog can be found here.

Conclusion

Laravel 5.4 has introduced several exciting features, along with significant improvements in existing features. In this article, I briefly touched upon several important new features and mentioned important entries in the changelog. If I have missed out any important detail or you would like to contribute to the discussion, do leave a comment below.

Ahmed Khan: Ahmed was a PHP community expert at Cloudways - A Managed PHP Hosting Cloud Platform. He is a software engineer with extensive knowledge in PHP and SEO. He loves watching Game of Thrones is his free time. Follow Ahmed on Twitter to stay updated with his works. You can email him at ahmed.khan@cloudways.com