{"id":36238307,"url":"https://github.com/thenlabs/meta-parser","last_synced_at":"2026-01-13T21:40:34.696Z","repository":{"id":48913444,"uuid":"517083268","full_name":"thenlabs/meta-parser","owner":"thenlabs","description":"Extract metadata from attributes and/or annotations.","archived":false,"fork":false,"pushed_at":"2022-07-25T12:26:09.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-11T11:44:01.669Z","etag":null,"topics":["annotations","attributes","doctrine-annotations","metadata-parser","parser"],"latest_commit_sha":null,"homepage":"","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/thenlabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-23T14:42:42.000Z","updated_at":"2022-07-25T12:17:33.000Z","dependencies_parsed_at":"2022-09-26T21:31:24.266Z","dependency_job_id":null,"html_url":"https://github.com/thenlabs/meta-parser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thenlabs/meta-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thenlabs%2Fmeta-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thenlabs%2Fmeta-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thenlabs%2Fmeta-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thenlabs%2Fmeta-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thenlabs","download_url":"https://codeload.github.com/thenlabs/meta-parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thenlabs%2Fmeta-parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28401049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"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":["annotations","attributes","doctrine-annotations","metadata-parser","parser"],"created_at":"2026-01-11T06:05:48.917Z","updated_at":"2026-01-13T21:40:34.684Z","avatar_url":"https://github.com/thenlabs.png","language":"PHP","readme":"\n# MetaParser\n\nExtract metadata from attributes and/or annotations.\n\n#### If you like this project gift us a ⭐.\n\n\u003chr /\u003e\n\n## Installation.\n\n    composer require thenlabs/meta-parser dev-main\n\n## Usage example.\n\n```php\n/**\n * @MyMetadata(data1=\"value1\")\n */\n#[MyMetadata(data1: 'value2')]\nclass MyClass\n{\n}\n\n$myClass = new ReflectionClass(MyClass::class);\n\n/**\n * Reading from annotations only.\n */\n$annotationParser = new ThenLabs\\MetaParser\\AnnotationParser();\n$annotationParserResult = $annotationParser-\u003eparse($myClass);\n\n$annotationParserResult-\u003eget(MyMetadata::class)-\u003eget('data1') === 'value1'; // true\n\n/**\n * Reading from attributes only.\n */\n$attributeParser = new ThenLabs\\MetaParser\\AttributeParser();\n$attributeParserResult = $attributeParser-\u003eparse($myClass);\n\n$attributeParserResult-\u003eget(MyMetadata::class)-\u003eget('data1') === 'value2'; // true\n\n/**\n * Reading both.\n */\n$parser = new ThenLabs\\MetaParser\\Parser();\n$parserResult = $parser-\u003eparse($myClass);\n\n// this returns true becouse attributes override annotations.\n$parserResult-\u003eget(MyMetadata::class)-\u003eget('data1') === 'value2';\n```\n\n### Highlights about `ThenLabs\\MetaParser\\Parser` class.\n\n#### 1. For read annotations it's necessary to install [Doctrine Annotations](https://www.doctrine-project.org/projects/doctrine-annotations/en/1.13/index.html):\n\n    $ composer require doctrine/annotations\n\n#### 2. The attribute parser require a PHP version grater than 8.0.\n#### 3. The `parse()` methods accept an instance of `Reflector`, so that, for parse a method of a class(for example), you can use a `ReflectionMethod` instance.\n\n## Development.\n\nClone this repository and install the Composer dependencies.\n\n    $ composer install\n\n### Running the tests.\n\nAll the tests of this project was written with our testing framework [PyramidalTests][pyramidal-tests] wich is based on [PHPUnit][phpunit].\n\nRun tests:\n\n    $ composer test\n\n[phpunit]: https://phpunit.de\n[pyramidal-tests]: https://github.com/thenlabs/pyramidal-tests\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthenlabs%2Fmeta-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthenlabs%2Fmeta-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthenlabs%2Fmeta-parser/lists"}