PHPackages                             lanfix/goaop-parser-reflection - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. lanfix/goaop-parser-reflection

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

lanfix/goaop-parser-reflection
==============================

Provides reflection information, based on raw source

4.0.1(4y ago)0234.5k↓44.4%11MITPHPPHP ^8.0

Since Nov 22Pushed 4y agoCompare

[ Source](https://github.com/lanfix/goaop-parser-reflection)[ Packagist](https://packagist.org/packages/lanfix/goaop-parser-reflection)[ RSS](/packages/lanfix-goaop-parser-reflection/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (28)Used By (1)

Parser Reflection API Library
-----------------------------

[](#parser-reflection-api-library)

This library is **deprecated**. Please use [BetterReflection](https://github.com/Roave/BetterReflection).

Parser Reflection API library provides a set of classes that extend original internal Reflection classes, but powered by [PHP-Parser](https://github.com/nikic/PHP-Parser) library thus allowing to create a reflection instance without loading classes into the memory.

This library can be used for analysing the source code; for automatic proxy creation and much more.

[![Build Status](https://camo.githubusercontent.com/7e6793882136ee731f031cb6255e97f0265d117fb503afa70013d44b97e21f81/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f676f616f702f7061727365722d7265666c656374696f6e2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/goaop/parser-reflection/build-status/master)[![Code Coverage](https://camo.githubusercontent.com/292e9db98926fa0888073f43bf2ba5eb241d3747e66430ab50c0f5adf898f955/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f676f616f702f7061727365722d7265666c656374696f6e2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/goaop/parser-reflection/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/dbb59ed27bd55a0a44060000815d6bd9068edb024445c0a550357deee5219603/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f676f616f702f7061727365722d7265666c656374696f6e2e737667)](https://packagist.org/packages/goaop/parser-reflection)[![Daily Downloads](https://camo.githubusercontent.com/6dc6d20c5c14e0fefd816fe9933c68a62bf5a0879aaf5e175e2eb30f09a20291/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64642f676f616f702f7061727365722d7265666c656374696f6e2e737667)](https://packagist.org/packages/goaop/parser-reflection)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/ecfcca7e746758f71a1656087c6b678fc6c165569a0370fd7bebbdd2a7bf78b2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f676f616f702f7061727365722d7265666c656374696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/goaop/parser-reflection/?branch=master)[![PHP Version](https://camo.githubusercontent.com/eed4d5cf01364b115489810f47ed4b33191d997e7ab4014f3daff1c09fbae7d9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e332d3838393242462e737667)](https://php.net/)[![License](https://camo.githubusercontent.com/9e266e078f7e7dfea20ef4db560a66d4a27ff84c76ba46befdc9d50423600825/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f676f616f702f7061727365722d7265666c656374696f6e2e737667)](https://packagist.org/packages/goaop/parser-reflection)

Installation
------------

[](#installation)

Library can be installed with Composer. Installation is quite easy:

```
$ composer require goaop/parser-reflection
```

Composer will install the library to your project's `vendor/goaop/parser-reflection` directory.

Usage
-----

[](#usage)

### Initialization

[](#initialization)

Prior to the first use library can be optionally initialized. If you use Composer for installing packages and loading classes, then you shouldn't worry about initialization, library will be initialized automatically.

If project uses a custom autoloader then you should follow the next steps:

1. Create a new class that implements `\Go\ParserReflection\LocatorInterface`
2. Create an instance of that class and pass it to the `ReflectionEngine::init()` method for initial configuration

### Reflecting concrete classes/methods/properties without loading them

[](#reflecting-concrete-classesmethodsproperties-without-loading-them)

Just use `Go\ParserReflection` package reflection classes like traditional ones:

```
$parsedClass = new \Go\ParserReflection\ReflectionClass(SomeClass::class);
var_dump($parsedClass->getMethods());

$parsedMethod = new \Go\ParserReflection\ReflectionMethod(SomeClass::class, 'someMethod');
echo (string)$parsedMethod;
```

Or you can use an additional classes [`ReflectionFile`](docs/reflection_file.md) and [`ReflectionFileNamespace`](docs/reflection_file_namespace.md) to analyse a raw PHP files:

```
$parsedFile     = new \Go\ParserReflection\ReflectionFile('SomeClass.php');
$fileNameSpaces = $parsedFile->getFileNamespaces();
// We can iterate over namespaces in the file
foreach ($fileNameSpaces as $namespace) {
    $classes = $namespace->getClasses();
    // Iterate over the classes in the namespace
    foreach ($classes as $class) {
        echo "Found class: ", $class->getName(), PHP_EOL;
        // Now let's show all methods in the class
        foreach ($class->getMethods() as $method) {
            echo "Found class method: ", $class->getName(), '::', $method->getName(), PHP_EOL;
        }

        // ...all properties in the class
        foreach ($class->getProperties() as $property) {
            echo "Found class property: ", $class->getName(), '->', $property->getName(), PHP_EOL;
        }
    }
}
```

How it works?
-------------

[](#how-it-works)

To understand how library works let's look at what happens during the call to the `new \Go\ParserReflection\ReflectionClass(SomeClass::class)`

- `\Go\ParserReflection\ReflectionClass` asks reflection engine to give an AST node for the given class name
- Reflection engine asks a locator to locate a filename for the given class
- `ComposerLocator` instance asks the Composer to find a filename for the given class and returns this result back to the reflection engine
- Reflection engine loads the content of file and passes it to the [PHP-Parser](https://github.com/nikic/PHP-Parser) for tokenization and processing
- PHP-Parser returns an AST (Abstract Syntax Tree)
- Reflection engine then analyse this AST to extract specific nodes and wrap them into corresponding reflection classes.

Compatibility
-------------

[](#compatibility)

All parser reflection classes extend PHP internal reflection classes, this means that you can use `\Go\ParserReflection\ReflectionClass` instance in any place that asks for `\ReflectionClass` instance. All reflection methods should be compatible with original ones, providing an except methods that requires object manipulation, such as `invoke()`, `invokeArgs()`, `setAccessible()`, etc. These methods will trigger the process of class loading and switching to the internal reflection.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 89.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~87 days

Recently: every ~47 days

Total

24

Last Release

1817d ago

Major Versions

0.6.0 → 1.0.0-alpha2015-12-26

1.4.1 → 2.0.02018-12-12

2.x-dev → 3.0.02020-11-19

3.0.1 → 4.0.02021-05-28

PHP version history (6 changes)0.5.0PHP &gt;=5.5.0

1.2.1PHP &gt;=5.6.0

2.0.0PHP &gt;=7.0

2.1.0PHP &gt;=7.1

3.0.0PHP &gt;=7.3

4.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/49123ae4b8a2e0e0779934e8625de2a0754fd9968d6cbfe8d319c6fc7ad700c1?d=identicon)[lanfix](/maintainers/lanfix)

---

Top Contributors

[![lisachenko](https://avatars.githubusercontent.com/u/640114?v=4)](https://github.com/lisachenko "lisachenko (254 commits)")[![MaximilianKresse](https://avatars.githubusercontent.com/u/545671?v=4)](https://github.com/MaximilianKresse "MaximilianKresse (7 commits)")[![xfuturomax](https://avatars.githubusercontent.com/u/8144576?v=4)](https://github.com/xfuturomax "xfuturomax (3 commits)")[![Fedott](https://avatars.githubusercontent.com/u/165486?v=4)](https://github.com/Fedott "Fedott (3 commits)")[![JustBlackBird](https://avatars.githubusercontent.com/u/1167086?v=4)](https://github.com/JustBlackBird "JustBlackBird (2 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (2 commits)")[![loren-osborn](https://avatars.githubusercontent.com/u/2467372?v=4)](https://github.com/loren-osborn "loren-osborn (2 commits)")[![lanfix](https://avatars.githubusercontent.com/u/47291532?v=4)](https://github.com/lanfix "lanfix (2 commits)")[![func0der](https://avatars.githubusercontent.com/u/529819?v=4)](https://github.com/func0der "func0der (2 commits)")[![VolCh](https://avatars.githubusercontent.com/u/396345?v=4)](https://github.com/VolCh "VolCh (1 commits)")[![ddinchev](https://avatars.githubusercontent.com/u/1397692?v=4)](https://github.com/ddinchev "ddinchev (1 commits)")[![dg](https://avatars.githubusercontent.com/u/194960?v=4)](https://github.com/dg "dg (1 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")[![pdelre](https://avatars.githubusercontent.com/u/1379248?v=4)](https://github.com/pdelre "pdelre (1 commits)")[![siwinski](https://avatars.githubusercontent.com/u/1034024?v=4)](https://github.com/siwinski "siwinski (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lanfix-goaop-parser-reflection/health.svg)

```
[![Health](https://phpackages.com/badges/lanfix-goaop-parser-reflection/health.svg)](https://phpackages.com/packages/lanfix-goaop-parser-reflection)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M568](/packages/symfony-maker-bundle)[roave/backward-compatibility-check

Tool to compare two revisions of a public API to check for BC breaks

5953.3M56](/packages/roave-backward-compatibility-check)[coenjacobs/mozart

Composes all dependencies as a package inside a WordPress plugin

4723.6M20](/packages/coenjacobs-mozart)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[recca0120/laravel-erd

Laravel ERD automatically generates Entity-Relationship Diagrams from your Laravel models and displays them using Vuerd.

36072.0k](/packages/recca0120-laravel-erd)[ondrejmirtes/better-reflection

Better Reflection - an improved code reflection API

136.2M4](/packages/ondrejmirtes-better-reflection)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
