All Projects â†’ glayzzle â†’ php-reflection

glayzzle / php-reflection

Licence: BSD-3-Clause license
🔎 Nodejs Reflection API for PHP files based on the php-parser

Programming Languages

javascript
184084 projects - #8 most used programming language
PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to php-reflection

rubocop-graphql
Rubocop extension for enforcing graphql-ruby best practices
Stars: ✭ 143 (+615%)
Mutual labels:  static-code-analysis
violation-comments-to-stash-plugin
Comments Bitbucket Server (or Stash) pull requests with static code analyzer findings.
Stars: ✭ 41 (+105%)
Mutual labels:  static-code-analysis
openapi
GitHub's official OpenAPI spec with Octokit extensions
Stars: ✭ 24 (+20%)
Mutual labels:  tooling
unimport
unimport is a Go static analysis tool to find unnecessary import aliases.
Stars: ✭ 64 (+220%)
Mutual labels:  static-code-analysis
origami-build-tools
Standard Origami component development tools.
Stars: ✭ 49 (+145%)
Mutual labels:  tooling
toast
Plugin-driven CLI utility for code generation using Go source as IDL
Stars: ✭ 52 (+160%)
Mutual labels:  tooling
violation-comments-to-github-plugin
Comments GitHub pull requests with static code analyzer findings.
Stars: ✭ 24 (+20%)
Mutual labels:  static-code-analysis
datree
Prevent Kubernetes misconfigurations from reaching production (again 😤 )! From code to cloud, Datree provides an E2E policy enforcement solution to run automatic checks for rule violations. See our docs: https://hub.datree.io
Stars: ✭ 5,744 (+28620%)
Mutual labels:  static-code-analysis
gotcha
Go Taint CHeck Analyser
Stars: ✭ 40 (+100%)
Mutual labels:  static-code-analysis
wcm-io-tooling
Tooling for Maven and IDEs.
Stars: ✭ 12 (-40%)
Mutual labels:  tooling
eslintcc
Complexity of Code - JavaScript/TypeScript
Stars: ✭ 15 (-25%)
Mutual labels:  static-code-analysis
vandal
Static program analysis framework for Ethereum smart contract bytecode.
Stars: ✭ 121 (+505%)
Mutual labels:  static-code-analysis
elm-review
Analyzes Elm projects, to help find mistakes before your users find them.
Stars: ✭ 195 (+875%)
Mutual labels:  static-code-analysis
standard-www
👆 Website for JavaScript Standard Style (@standard)
Stars: ✭ 28 (+40%)
Mutual labels:  static-code-analysis
identypo
identypo is a Go static analysis tool to find typos in identifiers (functions, function calls, variables, constants, type declarations, packages, labels).
Stars: ✭ 26 (+30%)
Mutual labels:  static-code-analysis
gruntworkflows
Repository for my tutorial course: Grunt.js Web Workflows on LinkedIn Learning and Lynda.com.
Stars: ✭ 28 (+40%)
Mutual labels:  tooling
hsx
Static HTML sites with JSX and webpack (no React).
Stars: ✭ 15 (-25%)
Mutual labels:  tooling
easy-hls-nix
Easy Haskell Language Server tooling with Nix!
Stars: ✭ 56 (+180%)
Mutual labels:  tooling
scope-capture-nrepl
nREPL middleware for scope-capture
Stars: ✭ 27 (+35%)
Mutual labels:  tooling
awesome-frappe
A curated list of awesome things related to the Frappe Framework
Stars: ✭ 140 (+600%)
Mutual labels:  tooling

PHP Reflection

npm version Build Status Coverage Status Gitter

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

Install

npm install php-reflection --save

Usage

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 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].