Oliver Davies

Examples of using Laravel Collections in Drupal

23rd August 2018

Since starting to work with Laravel as well as Drupal and Symfony, watching Adam Wathan’s Refactoring to Collections course as well as lessons on Laracasts, I’ve become a fan of Laravel’s Illuminate Collections and the object-orientated pipeline approach for interacting with PHP arrays.

In fact I’ve given a talk on using Collections outside Laravel and have written a Collection class module for Drupal 7.

I’ve also tweeted several examples of code that I’ve written within Drupal that use Collections, and I thought it would be good to collate them all here for reference.

Thanks again to Tighten for releasing and maintaining the tightenco/collect library that makes it possible to pull in Collections via Composer.

Questions? Comments? I’m @opdavies on Twitter, or send me an email.

Tags

About the Author

Picture of Oliver

Oliver Davies is a full-stack Web Developer and System Administrator based in the UK. He is a Senior Developer at Microserve and a part-time freelancer specialising in Drupal, Symfony and Laravel development and Linux systems administration.