uuid: - value: ec354679-9830-4361-b0eb-16e976e888ce langcode: - value: en type: - target_id: daily_email target_type: node_type target_uuid: 8bde1f2f-eef9-4f2d-ae9c-96921f8193d7 revision_timestamp: - value: '2025-05-11T08:59:58+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-11T08:59:58+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: |
A few months ago, Beyond Blocks podcast guest Dan Leech give another talk at the PHP South West user group.
This talk was about building an expression language from scratch, but in one part of the talk, Dan showed how he creates Collection classes.
I use Collection classes a lot, have given talks about them and wrote a Collections module for Drupal 7.
In Dan's talk, instead of using a Collection from Laravel or Doctrine, he created his own.
His extended PHP's IteratorAggregate
class so had no external dependencies.
He could then add whatever additional methods and functionality he needed.
Looking at other repositories on GitHub, I was able to find other examples.
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.
format: full_html processed: |A few months ago, Beyond Blocks podcast guest Dan Leech give another talk at the PHP South West user group.
This talk was about building an expression language from scratch, but in one part of the talk, Dan showed how he creates Collection classes.
I use Collection classes a lot, have given talks about them and wrote a Collections module for Drupal 7.
In Dan's talk, instead of using a Collection from Laravel or Doctrine, he created his own.
His extended PHP's IteratorAggregate
class so had no external dependencies.
He could then add whatever additional methods and functionality he needed.
Looking at other repositories on GitHub, I was able to find other examples.
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.
summary: null field_daily_email_cta: { }