76 lines
3.6 KiB
YAML
76 lines
3.6 KiB
YAML
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: |
|
|
<p>A few months ago, <a href="/podcast/6-dan-leech-php-tui">Beyond Blocks podcast guest Dan Leech</a> give another talk at the PHP South West user group.</p>
|
|
|
|
<p>This talk was about <a href="https://www.youtube.com/watch?v=UpyVAcWGQhg">building an expression language from scratch</a>, but in one part of the talk, Dan showed how he creates Collection classes.</p>
|
|
|
|
<p>I use Collection classes a lot, have <a href="/presentations/using-illuminate-collections-outside-laravel">given talks about them</a> and <a href="https://www.drupal.org/project/collection_class">wrote a Collections module for Drupal 7</a>.</p>
|
|
|
|
<p>In Dan's talk, instead of using a Collection from Laravel or Doctrine, <a href="https://github.com/dantleech/onehourexpr/blob/8c4ee4a3c1680455118e16a3e1be2a08418ab207/src/Tokens.php">he created his own</a>.</p>
|
|
|
|
<p>His extended PHP's <code>IteratorAggregate</code> class so had no external dependencies.</p>
|
|
|
|
<p>He could then add whatever additional methods and functionality he needed.</p>
|
|
|
|
<p>Looking at other repositories on GitHub, I was able to find other examples.</p>
|
|
|
|
<p>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>
|
|
|
|
|
|
format: full_html
|
|
processed: |
|
|
<p>A few months ago, <a href="http://default/podcast/6-dan-leech-php-tui">Beyond Blocks podcast guest Dan Leech</a> give another talk at the PHP South West user group.</p>
|
|
|
|
<p>This talk was about <a href="https://www.youtube.com/watch?v=UpyVAcWGQhg">building an expression language from scratch</a>, but in one part of the talk, Dan showed how he creates Collection classes.</p>
|
|
|
|
<p>I use Collection classes a lot, have <a href="http://default/presentations/using-illuminate-collections-outside-laravel">given talks about them</a> and <a href="https://www.drupal.org/project/collection_class">wrote a Collections module for Drupal 7</a>.</p>
|
|
|
|
<p>In Dan's talk, instead of using a Collection from Laravel or Doctrine, <a href="https://github.com/dantleech/onehourexpr/blob/8c4ee4a3c1680455118e16a3e1be2a08418ab207/src/Tokens.php">he created his own</a>.</p>
|
|
|
|
<p>His extended PHP's <code>IteratorAggregate</code> class so had no external dependencies.</p>
|
|
|
|
<p>He could then add whatever additional methods and functionality he needed.</p>
|
|
|
|
<p>Looking at other repositories on GitHub, I was able to find other examples.</p>
|
|
|
|
<p>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>
|
|
|
|
|
|
summary: null
|
|
field_daily_email_cta: { }
|