{"id":19986992,"url":"https://github.com/glayzzle/php-reflection","last_synced_at":"2025-05-04T08:31:04.700Z","repository":{"id":35714612,"uuid":"39992628","full_name":"glayzzle/php-reflection","owner":"glayzzle","description":":mag_right: Nodejs Reflection API for PHP files based on the php-parser","archived":false,"fork":false,"pushed_at":"2021-08-03T19:17:21.000Z","size":1023,"stargazers_count":27,"open_issues_count":24,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-08T05:51:23.558Z","etag":null,"topics":["php","reflection","static-code-analysis","tooling"],"latest_commit_sha":null,"homepage":"http://glayzzle.com/php-reflection/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/glayzzle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2015-07-31T07:27:34.000Z","updated_at":"2024-09-25T20:04:41.000Z","dependencies_parsed_at":"2022-09-12T05:50:46.510Z","dependency_job_id":null,"html_url":"https://github.com/glayzzle/php-reflection","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/glayzzle%2Fphp-reflection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glayzzle%2Fphp-reflection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glayzzle%2Fphp-reflection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glayzzle%2Fphp-reflection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glayzzle","download_url":"https://codeload.github.com/glayzzle/php-reflection/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252307756,"owners_count":21727063,"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":["php","reflection","static-code-analysis","tooling"],"created_at":"2024-11-13T04:32:30.971Z","updated_at":"2025-05-04T08:30:59.691Z","avatar_url":"https://github.com/glayzzle.png","language":"JavaScript","readme":"# PHP Reflection\n\n[![npm version](https://badge.fury.io/js/php-reflection.svg)](https://www.npmjs.com/package/php-reflection)\n[![Build Status](https://travis-ci.org/glayzzle/php-reflection.svg?branch=master)](https://travis-ci.org/glayzzle/php-reflection)\n[![Coverage Status](https://coveralls.io/repos/github/glayzzle/php-reflection/badge.svg?branch=master)](https://coveralls.io/github/glayzzle/php-reflection?branch=master)\n[![Gitter](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/glayzzle/Lobby)\n\nNodejs Reflection API for PHP files based on the [php-parser](https://github.com/glayzzle/php-parser)\n\n# Install\n\n```sh\nnpm install php-reflection --save\n```\n\n# Usage\n\n```js\nvar reflection = require('php-reflection');\nvar workspace = new reflection.Repository('/home/devbox/my-project', {\n    // actual default options :\n    exclude: ['.git', '.svn'],\n    include: ['./'],\n    ext: [\n        '*.php','*.php3','*.php5','*.phtml',\n        '*.inc','*.class','*.req'\n    ],\n    scanVars: true,\n    scanExpr: true,\n    encoding: 'utf8',\n    cacheByFileSize: true\n});\nvar workers = [\n    workspace.parse('some-file.php'),\n    workspace.parse('another-file.php'),\n    workspace.parse('test-file.php')\n];\nPromise.all(workers).then(function() {\n    console.log('-- list of functions :');\n    workspace.getByType('function').each(function(fn) {\n        console.log('Function Name : ', fn.name);\n        console.log('Located into : ', fn.getFile().name);\n        console.log('At line : ', fn.position.start.line);\n    });\n});\n```\n\nRead the [API docs](https://github.com/glayzzle/php-reflection/tree/master/docs) for more details.\n\n# What it can do\n\n - Fully reflection support (classes, inheritance, documentation blocks)\n - Recursively scan directories and add files to repository\n - Request cross files elements (like retrieving a class)\n - Put in-memory documents structure (with a small memory footprint)\n - You can use a cache engine for the repository\n - It avoids parsing a file that is already in memory and not modified since last parsing\n - Symbols relations (what variable instanciate a class, or who extends that class)\n - A cool (and really fast) requesting engine for retrieving elements\n\n# What you could do with it\n\n - Write a documentation generator\n - Write a static code generator based on relection (like an ORM)\n - Write a code analysis tool (like phpMessDetector)\n - Write a code completion plugin\n\n... if you want to share an idea or your project make a pull request\n\n# Benchmark\n\n\n# WIP Disclaimer\n\nThis project is actually on it's early alpha stage. It may progress rapidly, so watch the project if you are interested to use it.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglayzzle%2Fphp-reflection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglayzzle%2Fphp-reflection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglayzzle%2Fphp-reflection/lists"}