PHP Reflection
Nodejs Reflection API for PHP files based on the php-parser
Install
npm install php-reflection --save
Usage
var reflection = ;var workspace = '/home/devbox/my-project' // actual default options : exclude: '.git' '.svn' include: './' ext: '*.php''*.php3''*.php5''*.phtml' '*.inc''*.class''*.req' scanVars: true scanExpr: true encoding: 'utf8' cacheByFileSize: true;var workers = workspace workspace workspace;Promiseallworkers;
Read the API docs for more details.
What it can do
- Fully reflection support (classes, inheritance, documentation blocks)
- Recursively scan directories and add files to repository
- Request cross files elements (like retrieving a class)
- Put in-memory documents structure (with a small memory footprint)
- You can use a cache engine for the repository
- It avoids parsing a file that is already in memory and not modified since last parsing
- Symbols relations (what variable instanciate a class, or who extends that class)
- A cool (and really fast) requesting engine for retrieving elements
What you could do with it
- Write a documentation generator
- Write a static code generator based on relection (like an ORM)
- Write a code analysis tool (like phpMessDetector)
- Write a code completion plugin
... if you want to share an idea or your project make a pull request
Benchmark
WIP Disclaimer
This project is actually on it's early alpha stage. It may progress rapidly, so watch the project if you are interested to use it.