{"id":26365473,"url":"https://github.com/felixdorn/tag","last_synced_at":"2026-06-24T17:31:39.220Z","repository":{"id":62504038,"uuid":"211542153","full_name":"felixdorn/tag","owner":"felixdorn","description":"Generates HTML in a clean and convenient syntax.","archived":false,"fork":false,"pushed_at":"2022-10-11T21:29:35.000Z","size":80,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-10T22:17:40.941Z","etag":null,"topics":["html","oop","package","php-library"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/felixdorn/tag","language":"PHP","has_issues":true,"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/felixdorn.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":"2019-09-28T18:06:47.000Z","updated_at":"2023-02-25T15:51:03.000Z","dependencies_parsed_at":"2022-11-02T12:31:07.433Z","dependency_job_id":null,"html_url":"https://github.com/felixdorn/tag","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixdorn%2Ftag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixdorn%2Ftag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixdorn%2Ftag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixdorn%2Ftag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/felixdorn","download_url":"https://codeload.github.com/felixdorn/tag/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243921611,"owners_count":20369251,"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":["html","oop","package","php-library"],"created_at":"2025-03-16T19:38:11.858Z","updated_at":"2026-06-24T17:31:39.188Z","avatar_url":"https://github.com/felixdorn.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tag\n![Packagist](https://img.shields.io/packagist/l/felixdorn/tag)\n![Packagist Version](https://img.shields.io/packagist/v/felixdorn/tag)\n\n## Getting started\nYou can install the package via composer, if you don't have composer, you can download it [here](https://getcomposer.org/):\n\n```bash\ncomposer require felixdorn/tag\n```\nOr by adding a requirement in your composer.json:\n```json\n{\n    \"require\": {\n        \"felixdorn/tag\": \"^2.0.0\"\n    }\n}\n```\n\n## Usage\n```php\n$tag = tag('div')\n    -\u003eclass('container')\n    -\u003echildren(\n        tag('h1')-\u003echildren('Title'),\n        'Some raw content'\n    );\n```\n\n### Adding attributes\nWe use the magic method `__call` to add attributes. You can add any attribute you want.\n\n```php\ntag('div')\n    -\u003eclass('alert alert-danger')\n    -\u003echildren('Something went wrong');\n```\n\nTo add attributes containing a dash like `aria-hidden`, use the equivalent in camel case (ariaHidden). We'll do the conversion back to kebab case when rendering the tag.\n\nYou can also assign multiple attributes at once.\n```php\ntag('div')\n    -\u003eattributes([\n    'id' =\u003e 'my-div',\n    'class' =\u003e 'mt-2'\n]);\n```\n\n### Nested tags\n```php\ntag('div')\n    -\u003eclass('container')\n    -\u003echildren(\n        tag('h1')-\u003echildren('Some text')\n    );\n\ntag('div')\n    -\u003echildren([\n        tag('h1')-\u003echildren(\n            tag('span')-\u003echildren('Hello'),\n            tag('b')-\u003echildren('World'),\n        ),\n        tag('br'),\n        tag('h3')-\u003echildren('Whatever')    \n    ]);\n```\n\n## Credits\n* [Félix Dorn](mailto:github@felixdorn.fr)\n\n## License\nThis project is MIT Licensed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixdorn%2Ftag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelixdorn%2Ftag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixdorn%2Ftag/lists"}