{ "uuid": [ { "value": "03653911-19e8-4f60-8baa-5165b8380d29" } ], "langcode": [ { "value": "en" } ], "type": [ { "target_id": "daily_email", "target_type": "node_type", "target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7" } ], "revision_timestamp": [ { "value": "2025-05-01T23:43:31+00:00" } ], "revision_uid": [ { "target_type": "user", "target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849" } ], "revision_log": [], "status": [ { "value": true } ], "uid": [ { "target_type": "user", "target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849" } ], "title": [ { "value": "Dependency-free PHP Collections" } ], "created": [ { "value": "2025-03-29T00:00:00+00:00" } ], "changed": [ { "value": "2025-05-01T23:43:31+00:00" } ], "promote": [ { "value": false } ], "sticky": [ { "value": false } ], "default_langcode": [ { "value": true } ], "revision_translation_affected": [ { "value": true } ], "path": [ { "alias": "\/daily\/2025\/03\/29\/collections", "langcode": "en" } ], "body": [ { "value": "\n

A few months ago, Beyond Blocks podcast guest Dan Leech<\/a> give another talk at the PHP South West user group.<\/p>\n\n

This talk was about building an expression language from scratch<\/a>, but in one part of the talk, Dan showed how he creates Collection classes.<\/p>\n\n

I use Collection classes a lot, have given talks about them<\/a> and wrote a Collections module for Drupal 7<\/a>.<\/p>\n\n

In Dan's talk, instead of using a Collection from Laravel or Doctrine, he created his own<\/a>.<\/p>\n\n

His extended PHP's IteratorAggregate<\/code> class so had no external dependencies.<\/p>\n\n

He could then add whatever additional methods and functionality he needed.<\/p>\n\n

Looking at other repositories on GitHub, I was able to find other examples.<\/p>\n\n

I've done this on projects since Dan's talk and like taking the minimalist approach - avoiding adding a dependency to my project and only adding the functionality I need and functionality that's more specific to my domain.<\/p>\n\n ", "format": "full_html", "processed": "\n

A few months ago, Beyond Blocks podcast guest Dan Leech<\/a> give another talk at the PHP South West user group.<\/p>\n\n

This talk was about building an expression language from scratch<\/a>, but in one part of the talk, Dan showed how he creates Collection classes.<\/p>\n\n

I use Collection classes a lot, have given talks about them<\/a> and wrote a Collections module for Drupal 7<\/a>.<\/p>\n\n

In Dan's talk, instead of using a Collection from Laravel or Doctrine, he created his own<\/a>.<\/p>\n\n

His extended PHP's IteratorAggregate<\/code> class so had no external dependencies.<\/p>\n\n

He could then add whatever additional methods and functionality he needed.<\/p>\n\n

Looking at other repositories on GitHub, I was able to find other examples.<\/p>\n\n

I've done this on projects since Dan's talk and like taking the minimalist approach - avoiding adding a dependency to my project and only adding the functionality I need and functionality that's more specific to my domain.<\/p>\n\n ", "summary": null } ], "feeds_item": [ { "imported": "2025-05-01T23:43:31+00:00", "guid": null, "hash": "94b06833489046a4c26442548eee3ca2", "target_type": "feeds_feed", "target_uuid": "90c85284-7ca8-4074-9178-97ff8384fe76" } ] }