{"id":19214203,"url":"https://github.com/igniphp/reflection-api","last_synced_at":"2026-06-10T20:32:02.634Z","repository":{"id":56989377,"uuid":"131956091","full_name":"igniphp/reflection-api","owner":"igniphp","description":"Reflection api and class builder kit for php","archived":false,"fork":false,"pushed_at":"2018-05-14T13:36:01.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-13T20:23:42.716Z","etag":null,"topics":["class-builder","php","reflection"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/igniphp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-03T07:11:49.000Z","updated_at":"2025-02-14T16:33:36.000Z","dependencies_parsed_at":"2022-08-21T12:50:51.636Z","dependency_job_id":null,"html_url":"https://github.com/igniphp/reflection-api","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/igniphp/reflection-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igniphp%2Freflection-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igniphp%2Freflection-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igniphp%2Freflection-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igniphp%2Freflection-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/igniphp","download_url":"https://codeload.github.com/igniphp/reflection-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igniphp%2Freflection-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34170162,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["class-builder","php","reflection"],"created_at":"2024-11-09T14:09:27.844Z","updated_at":"2026-06-10T20:32:02.616Z","avatar_url":"https://github.com/igniphp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![Igni logo](https://github.com/igniphp/common/blob/master/logo/full.svg)\n[![Build Status](https://travis-ci.org/igniphp/reflection-api.svg?branch=master)](https://travis-ci.org/igniphp/reflection-api)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/igniphp/reflection-api/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/igniphp/reflection-api/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/igniphp/reflection-api/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/igniphp/reflection-api/?branch=master)\n\n## Installation\n```\ncomposer require igniphp/reflection-api\n```\n\n## Reflection API\nLicensed under MIT License.\n\nReflection api provides tools that allows to:\n - read and write object's properties\n - build classes on runtime\n - retrieves closure's body\n - instantiating objects without reflection api\n\n### Reading object's properties\n\n```php\nuse Igni\\Utils\\ReflectionApi;\n\nclass TestClass\n{\n    private $test;\n    \n    public function __construct()\n    {\n        $this-\u003etest = 1;\n    }\n}\n\n$instance = new TestClass();\n\nReflectionApi::readProperty($instance, 'test');\n```\n\n### Write object's properties\n\n```php\nuse Igni\\Utils\\ReflectionApi;\n\nclass TestClass\n{\n    private $test;\n    \n    public function __construct()\n    {\n        $this-\u003etest = 1;\n    }\n}\n\n$instance = new TestClass();\n\nReflectionApi::writeProperty($instance, 'test', 2);\n```\n\n### Create an instance\n\n```php\nuse Igni\\Utils\\ReflectionApi;\n\nclass TestClass\n{\n    private $test;\n    \n    public function __construct()\n    {\n        $this-\u003etest = 1;\n    }\n}\n\n$instance = ReflectionApi::createInstance(TestClass::class);\n```\n\n### Building and loading class on runtime\n\n```php\nuse Igni\\Utils\\ReflectionApi;\nuse Igni\\Utils\\ReflectionApi\\RuntimeProperty;\nuse Igni\\Utils\\ReflectionApi\\RuntimeMethod;\n\n$class = ReflectionApi::createClass('TestClass');\n\n$class-\u003eaddProperty((new RuntimeProperty('test))-\u003emakePrivate());\n\n$constructor = new RuntimeMethod('__construct');\n$constructor-\u003eaddBody(\n    '$this-\u003etest = 1'\n);\n\n$getTest = new RuntimeMethod('getTest');\n$getTest-\u003esetReturnType('string');\n$getTest-\u003eaddBody(\n    'return $this-\u003etest'\n);\n\n$class-\u003eaddMethod($constructor);\n$class-\u003eaddMethod($getTest);\n\n$class-\u003eload();\n\n$instance = $class-\u003ecreateInstance();\n\n$instance instanceof 'TestClass';// true.\n$instance-\u003egetTest();// 1\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figniphp%2Freflection-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figniphp%2Freflection-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figniphp%2Freflection-api/lists"}