Skip to main content

Examples of using Laravel Collections in Drupal

Warning: This post is over a year old. I don't always update old posts with new information, so some of this information may be out of date.

Some examples of using Laravel’s Illuminate Collections within Drupal projects.

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.

Comments or questions? I'm @opdavies on Twitter.