{"id":16356755,"url":"https://github.com/mglaman/drupal-typed-data-by-example","last_synced_at":"2025-08-09T02:07:13.612Z","repository":{"id":45094108,"uuid":"441471266","full_name":"mglaman/drupal-typed-data-by-example","owner":"mglaman","description":"Drupal's Typed Data API by example","archived":false,"fork":false,"pushed_at":"2022-11-07T04:13:14.000Z","size":38,"stargazers_count":37,"open_issues_count":8,"forks_count":6,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-17T19:13:23.921Z","etag":null,"topics":["drupal"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mglaman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-24T13:20:53.000Z","updated_at":"2023-12-11T14:00:05.000Z","dependencies_parsed_at":"2022-09-02T22:33:48.296Z","dependency_job_id":null,"html_url":"https://github.com/mglaman/drupal-typed-data-by-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mglaman%2Fdrupal-typed-data-by-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mglaman%2Fdrupal-typed-data-by-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mglaman%2Fdrupal-typed-data-by-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mglaman%2Fdrupal-typed-data-by-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mglaman","download_url":"https://codeload.github.com/mglaman/drupal-typed-data-by-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244717377,"owners_count":20498283,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["drupal"],"created_at":"2024-10-11T01:44:14.618Z","updated_at":"2025-03-21T00:31:33.424Z","avatar_url":"https://github.com/mglaman.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Drupal's Typed Data API by example\n\nThis repository aims to help show use cases and various exercises with using Drupal's [Typed Data API](https://www.drupal.org/docs/8/api/typed-data-api/typed-data-api-overview). \n\n\u003e The Typed Data API was created to provide developers with a consistent way of interacting with data in different ways.\n\n## Purpose\n\nThis repository provides examples of using the Typed Data API. The examples range from generic usage explaining the different data types available, to creating complex data definitions, to utilizing them in real world Drupal applications.\n\nThe intent is not to _run_ this code in your Drupal site, but to browse the code examples.\n\n## Structure\n\nThe examples are broken into different groups, each with their own directory:\n\n* [`primitives`](https://github.com/mglaman/drupal-typed-data-by-example/tree/main/primitives): each example covers the data types provided by Drupal core. These are intended to be simplistic examples of using a value and wrapping it in Typed Data data types for validation and representation.\n* [`lists`](https://github.com/mglaman/drupal-typed-data-by-example/tree/main/lists): each example covers using lists (arrays of a specific type)\n* [`maps`](https://github.com/mglaman/drupal-typed-data-by-example/tree/main/maps): each example covers using the Map data type, which allows you to define complex data definitions to describe an object's shape.\n* [`serialization`](https://github.com/mglaman/drupal-typed-data-by-example/tree/main/serialization): each example shows how the Typed Data API integrates with Drupal's Serialization module, which leverages the Serializer component from Symfony.\n\n## Trying it out!\n\nAll of the examples can be run to see sample outputs.\n\nFirst, install the dependencies and generate the autoloader (requires PHP `^8.0`):\n\n```bash\ncomposer install\n```\n\nFor example, the following will run the `emails` example in `primitives/` and print any of the additional output provided for context.\n\n```bash\nphp primitives/email.php\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmglaman%2Fdrupal-typed-data-by-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmglaman%2Fdrupal-typed-data-by-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmglaman%2Fdrupal-typed-data-by-example/lists"}