{"id":20914930,"url":"https://github.com/psychob/reflection-file","last_synced_at":"2026-02-06T21:32:36.762Z","repository":{"id":57045618,"uuid":"192730074","full_name":"psychob/reflection-file","owner":"psychob","description":"PHP Abstraction for reflection file","archived":false,"fork":false,"pushed_at":"2025-01-26T03:29:29.000Z","size":69,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-07T09:42:24.700Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/psychob.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-19T12:42:24.000Z","updated_at":"2025-01-26T03:28:43.000Z","dependencies_parsed_at":"2025-03-12T23:13:12.863Z","dependency_job_id":"1c8d9b46-223f-489f-93e0-ef3468981e14","html_url":"https://github.com/psychob/reflection-file","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/psychob/reflection-file","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psychob%2Freflection-file","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psychob%2Freflection-file/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psychob%2Freflection-file/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psychob%2Freflection-file/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/psychob","download_url":"https://codeload.github.com/psychob/reflection-file/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psychob%2Freflection-file/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29177551,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T20:14:21.878Z","status":"ssl_error","status_checked_at":"2026-02-06T20:14:21.443Z","response_time":59,"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":"2024-11-18T16:12:11.761Z","updated_at":"2026-02-06T21:32:36.740Z","avatar_url":"https://github.com/psychob.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ReflectionFile\n\n[![Latest Stable Version](https://img.shields.io/packagist/v/psychob/reflection-file.svg)](https://packagist.org/packages/psychob/reflection-file)\n[![License](https://img.shields.io/badge/license-MPL--2.0-blue.svg)](LICENSE)\n[![PHP Version](https://img.shields.io/badge/php-%3E%3D8.3-8892BF.svg)](https://php.net/)\n\nA powerful PHP library for analyzing PHP files through reflection. This library extends PHP's native reflection capabilities by allowing you to examine PHP files without loading them into memory, providing information about classes, interfaces, traits, and other declarations.\n\n## Features\n\n- Analyze PHP files without executing them\n- Extract information about:\n    - Namespaces\n    - Classes (including abstract classes)\n    - Interfaces\n    - Traits\n    - Functions\n    - Objects\n    - Enums\n- Lazy loading support for better performance\n- Safe file parsing\n\n## Requirements\n\n- PHP 8.3 or higher\n- Composer\n\n## Installation\n\nInstall via Composer:\n\n```bash\ncomposer require psychob/reflection-file\n```\n\n## Usage\n\n### Basic Usage\n\n```php\n\u003c?php\nuse PsychoB\\ReflectionFile\\ReflectionFile;\n\n$reflection = new ReflectionFile('path/to/your/file.php');\n\n// Get all class names\n$classes = $reflection-\u003egetNamesOfClasses();\n\n// Get all interfaces\n$interfaces = $reflection-\u003egetNamesOfInterfaces();\n\n// Get all traits\n$traits = $reflection-\u003egetNamesOfTraits();\n\n// Get namespace information\n$namespace = $reflection-\u003egetFirstNameOfNamespace();\n```\n\n### Performance Optimization\n\nThe library supports deferred parsing and loading for better performance:\n\n```php\n\u003c?php\nuse PsychoB\\ReflectionFile\\ReflectionFile;\n\n// Defer both parsing and loading until needed\n$reflection = new ReflectionFile(\n    'path/to/file.php',\n    deferParsing: true,\n    deferLoading: true\n);\n\n// Only parse when needed\n$classes = $reflection-\u003egetNamesOfClasses(); // Triggers parsing\n\n// Manual control over loading\n$reflection-\u003eload(); // Explicitly load the file\n```\n\n## Advanced Features\n\n### Namespace Analysis\n\n```php\n$namespaces = $reflection-\u003egetNamesOfNamespaces();\n$firstNamespace = $reflection-\u003egetFirstNameOfNamespace();\n```\n\n### Class Analysis\n\n```php\n$classes = $reflection-\u003egetNamesOfClasses();\n$abstractClasses = $reflection-\u003egetNamesOfAbstractClasses();\n```\n\n### Other Declarations\n\n```php\n$interfaces = $reflection-\u003egetNamesOfInterfaces();\n$traits = $reflection-\u003egetNamesOfTraits();\n$functions = $reflection-\u003egetNamesOfFunctions();\n$enums = $reflection-\u003egetNamesOfEnums();\n```\n\n## Security Considerations\n\nThis library parses PHP files. Always ensure you're analyzing trusted files, as parsing untrusted PHP files could potentially expose your application to security risks.\n\n## License\n\nThis project is licensed under the Mozilla Public License Version 2.0 - see the [LICENSE](https://www.mozilla.org/en-US/MPL/2.0/) file for details.\n\n## Author\n\n- Andrzej Budzanowski \u003ckontakt@andrzej.budzanowski.pl\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsychob%2Freflection-file","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpsychob%2Freflection-file","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsychob%2Freflection-file/lists"}