A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/glayzzle/php-reflection below:

glayzzle/php-reflection: :mag_right: Nodejs Reflection API for PHP files based on the php-parser

Nodejs Reflection API for PHP files based on the php-parser

npm install php-reflection --save
var reflection = require('php-reflection');
var workspace = new reflection.Repository('/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.parse('some-file.php'),
    workspace.parse('another-file.php'),
    workspace.parse('test-file.php')
];
Promise.all(workers).then(function() {
    console.log('-- list of functions :');
    workspace.getByType('function').each(function(fn) {
        console.log('Function Name : ', fn.name);
        console.log('Located into : ', fn.getFile().name);
        console.log('At line : ', fn.position.start.line);
    });
});

Read the API docs for more details.

What you could do with it

... if you want to share an idea or your project make a pull request

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.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4