{"id":35122196,"url":"https://github.com/vardumper/html5-twig-component-bundle","last_synced_at":"2026-05-09T13:28:48.846Z","repository":{"id":328053446,"uuid":"1113357152","full_name":"vardumper/html5-twig-component-bundle","owner":"vardumper","description":"Symfony UX Twig Components for all HTML5 elements with ARIA support and static attribute validation via Enums. It provides auto-completion in your IDE of choice, so all available attributes can be quickly accessed.","archived":false,"fork":false,"pushed_at":"2026-03-31T09:01:05.000Z","size":873,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-31T11:04:29.666Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vardumper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["vardumper"],"buy_me_a_coffee":"vardumper","custom":["https://paypal.me/vardumper"]}},"created_at":"2025-12-09T21:40:53.000Z","updated_at":"2026-03-31T09:01:09.000Z","dependencies_parsed_at":"2026-03-31T11:02:06.405Z","dependency_job_id":null,"html_url":"https://github.com/vardumper/html5-twig-component-bundle","commit_stats":null,"previous_names":["vardumper/html5-twig-component-bundle"],"tags_count":56,"template":false,"template_full_name":null,"purl":"pkg:github/vardumper/html5-twig-component-bundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vardumper%2Fhtml5-twig-component-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vardumper%2Fhtml5-twig-component-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vardumper%2Fhtml5-twig-component-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vardumper%2Fhtml5-twig-component-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vardumper","download_url":"https://codeload.github.com/vardumper/html5-twig-component-bundle/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vardumper%2Fhtml5-twig-component-bundle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31292827,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T21:15:39.731Z","status":"ssl_error","status_checked_at":"2026-04-01T21:15:34.046Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2025-12-28T00:40:30.689Z","updated_at":"2026-05-09T13:28:48.835Z","avatar_url":"https://github.com/vardumper.png","language":"PHP","funding_links":["https://github.com/sponsors/vardumper","https://buymeacoffee.com/vardumper","https://paypal.me/vardumper"],"categories":[],"sub_categories":[],"readme":"[![Latest Stable Version](https://poser.pugx.org/vardumper/html5-twig-component-bundle/v/stable)](https://packagist.org/packages/vardumper/html5-twig-component-bundle) \n[![Total Downloads](https://poser.pugx.org/vardumper/html5-twig-component-bundle/downloads)](https://packagist.org/packages/vardumper/html5-twig-component-bundle) \n[![Vulnerabilities for html5-twig-component-bundle](https://dtrack.erikpoehler.us/api/v1/badge/vulns/project/404a3506-2b62-4a9e-8617-e80f3ebb1f03?apiKey=odt_nG83W_EAcQZkk6b5KqknIVoK8nfNjSz38Ompnn)](https://dtrack.erikpoehler.us/projects/404a3506-2b62-4a9e-8617-e80f3ebb1f03)\n\n\n# Twig Components for HTML5 Elements\n\nThis is a Symfony Bundle which adds pre-built, typesafe, auto-generated Twig Components for all HTML5 elements. It comes with full WCAG, ARIA support, also adds support for Alpine.js attributes. It makes use of [Extended HTMLDocument](https://github.com/vardumper/extended-htmldocument) which is a schema-first library that improves HTML5 support in PHP 8.4. Mainly used for validation of immutable enum attributes.\n\nThis is especially useful when writing anonymous Twig Components enforcing standards-compliance, always-valid HTML5.\n\n## Features\n\n- **Symfony UX Integration**: Native Symfony Twig Component support\n- **ARIA Compliant**: Complete ARIA attribute support with proper validation\n- **Auto-Generated**: Consistent API across all HTML5 elements via schema-first approach\n- **Enum Validation**: Static attribute validation for HTML compliance\n- **Modern PHP**: Requires PHP 8.4+ for DOM\\HTMLDocument features\n\n## Requirements\n* PHP 8.4 – the underlying Extended HTMLDocument library is built upon PHPs DOM\\HTMLDocument which is available since PHP 8.4+\n\nSince only the Enums are used for attribute validation here, adding support for older PHP versions could be done easily if it's needed or requested.\n\n## Installation\n\n```bash\ncomposer require vardumper/html5-twig-component-bundle\n```\n\nThe bundle includes automatic service registration - no additional configuration needed!\n\n## Configuration\n\nWhen installed via Symfony Flex, this bundle is automatically configured by the recipe in `flex/recipe`.\n\nIf you are not using Symfony Flex, register the bundle manually in `config/bundles.php`:\n\n```php\n# config/bundles.php\nreturn [\n    // ...\n    Html\\TwigComponentBundle\\HtmlTwigComponentBundle::class =\u003e ['all' =\u003e true],\n];\n```\n\nThen tell Symfony where the Twig Components are located. Edit `config/packages/twig_component.yaml` and add the following:\n\n```yaml\n# config/packages/twig_component.yaml\ntwig_component:\n    defaults:\n        Html\\TwigComponentBundle\\Twig\\: '%kernel.project_dir%/vendor/vardumper/html5-twig-component-bundle/src/Twig/'\n```\n\nAll Twig Components are automatically discovered and registered through the bundle's DependencyInjection extension. No manual service configuration required!\n\n## Usage\n\nUse any HTML element as a Twig Component:\n\n```twig\n\u003ctwig:Blockquote cite=\"https://example.com\"\u003e\n    This is a quote from example.com\n\u003c/twig:Blockquote\u003e\n\n\u003ctwig:Button role=\"button\" type=\"submit\"\u003e\n    Submit Form\n\u003c/twig:Button\u003e\n\n\u003ctwig:Input type=\"email\" name=\"email\" required /\u003e\n```\n\n### Use in anonymous Twig Components\n```twig\n{# templates/components/Teaser.html.twig #}\n\u003ctwig:Div class=\"teaser\"\u003e \n    \u003ctwig:H3\u003e{{ headline }}\u003c/twig:H3\u003e\n    \u003ctwig:P\u003e{{ content }}\u003c/twig:P\u003e\n    \u003ctwig:A role=\"button\" href=\"{{ buttonLink }}\" title=\"{{ buttonText }}\"\u003e{{ buttonText }}\u003c/twig:A\u003e\n\u003c/twig:Div\u003e\n```\n\nwhich can then be used in pages:\n```twig\n{# templates/page.html.twig #}\n{% for item in teasers %}\n    \u003ctwig:Teaser \n        headline=\"{{ item.headline }}\" \n        content=\"{{ item.content }}\" \n        buttonLink=\"{{ item.buttonLink }}\" \n        buttonText=\"{{ item.buttonText }}\"\u003e\n    \u003c/twig:Teaser\u003e\n{% endfor %}\n```\n\n### Passing arrays as component props\nYou can pass associative arrays to component props using the `:` notation. For example to pass `data-*` attributes to the component:\n```twig\n\u003ctwig:Div :dataAttributes=\"{'role': 'article'}\"\u003e\n    Hello world\n\u003c/twig:Div\u003e\n```\n\nThis will render a `data-role=\"article\"` attribute on the generated component's root element.\n## Features\n\n- ✅ All HTML5 elements supported\n- ✅ Full ARIA attributes support\n- ✅ Type-safe enum validation\n- ✅ PreMount validation with OptionsResolver\n- ✅ Proper namespace structure (Block/Inline/Void)\n\n## Components Structure\n\nComponents are organized by type:\n- `Block` - Block-level elements (div, section, article, etc.)\n- `Inline` - Inline elements (span, a, strong, etc.)\n- `Void` - non-rendered elements (head, wbr, meta, etc.)\n\n\n## Read More\n* [Extended HTMLDocument Documentation](https://vardumper.github.io/extended-htmldocument/)\n* [Extended HTMLDocument Github Repository](https://github.com/vardumper/extended-htmldocument)\n* [Twig Components](https://symfony.com/bundles/ux-twig-component/current/index.html)\n* [Symfony UX](https://ux.symfony.com/)\n\n## Issues \u0026 Bugs\n\nPlease report issues in this packages home at [Extended HTMLDocument](https://github.com/vardumper/extended-htmldocument)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvardumper%2Fhtml5-twig-component-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvardumper%2Fhtml5-twig-component-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvardumper%2Fhtml5-twig-component-bundle/lists"}