oliverdavies.uk/content/node.1b89a389-5899-4ce5-a3b3-b15ddb2169d8.json
2025-05-11 20:02:14 +01:00

100 lines
No EOL
4.8 KiB
JSON

{
"uuid": [
{
"value": "1b89a389-5899-4ce5-a3b3-b15ddb2169d8"
}
],
"langcode": [
{
"value": "en"
}
],
"type": [
{
"target_id": "daily_email",
"target_type": "node_type",
"target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7"
}
],
"revision_timestamp": [
{
"value": "2025-05-11T06:09:49+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-11T06:09:49+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 <p>A few months ago, <a href=\"https:\/\/www.oliverdavies.uk\/podcast\/6-dan-leech-php-tui\">Beyond Blocks podcast guest Dan Leech<\/a> give another talk at the PHP South West user group.<\/p>\n\n<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>\n\n<p>I use Collection classes a lot, have <a href=\"https:\/\/www.oliverdavies.uk\/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>\n\n<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>\n\n<p>His extended PHP's <code>IteratorAggregate<\/code> class so had no external dependencies.<\/p>\n\n<p>He could then add whatever additional methods and functionality he needed.<\/p>\n\n<p>Looking at other repositories on GitHub, I was able to find other examples.<\/p>\n\n<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>\n\n ",
"format": "full_html",
"processed": "\n <p>A few months ago, <a href=\"https:\/\/www.oliverdavies.uk\/podcast\/6-dan-leech-php-tui\">Beyond Blocks podcast guest Dan Leech<\/a> give another talk at the PHP South West user group.<\/p>\n\n<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>\n\n<p>I use Collection classes a lot, have <a href=\"https:\/\/www.oliverdavies.uk\/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>\n\n<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>\n\n<p>His extended PHP's <code>IteratorAggregate<\/code> class so had no external dependencies.<\/p>\n\n<p>He could then add whatever additional methods and functionality he needed.<\/p>\n\n<p>Looking at other repositories on GitHub, I was able to find other examples.<\/p>\n\n<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>\n\n ",
"summary": null
}
],
"feeds_item": [
{
"imported": "2025-05-11T06:09:49+00:00",
"guid": null,
"hash": "94b06833489046a4c26442548eee3ca2",
"target_type": "feeds_feed",
"target_uuid": "90c85284-7ca8-4074-9178-97ff8384fe76"
}
]
}