This package is abandoned and no longer maintained. The author suggests using the package instead.

Adds the ability to reverse-engineer classes, interfaces, functions, constants, namespaces, traits and more.

4.4.1 2020-10-06 15:55 UTC


Latest Stable Version Minimum PHP Version) EOL

PHP Reflect

PHP Reflect is a library that adds the ability to reverse-engineer classes, interfaces, functions, constants, namespaces, traits and more.

Running on PHP greater than 7.1 for parsing source code in a format PHP 5.2 to PHP 7.4


  • PHP 7.1.3 or greater
  • PHPUnit 7 or greater (if you want to run unit tests)


The recommended way to install this library is through composer. If you don't know yet what is composer, have a look on introduction.

composer require bartlett/php-reflect

Build PHAR distribution

To build PHAR distribution, you'll need to get a copy of this project

WARNING: Don't forget to run following command (before compiling archive), if you want to have a PHAR manifest up-to-date !

php phar-manifest.php > manifest.txt

Run following command

box.phar compile

You should get output that look like

Box version 3.8.4@120b0a3 2019-12-13 17:22:43 UTC

 // Loading the configuration file "/shared/backups/bartlett/php-reflect/box.json.dist".

🔨  Building the PHAR "/shared/backups/bartlett/php-reflect/bin/phpreflect.phar"

? No compactor to register
? Adding main file: /shared/backups/bartlett/php-reflect/bin/phpreflect
? Adding requirements checker
? Adding binary files
    > No file found
? Auto-discover files? No
? Exclude dev files? No
? Adding files
    > 890 file(s)
? Using stub file: /shared/backups/bartlett/php-reflect/phar-stub.php
? Skipping dumping the Composer autoloader
? Removing the Composer dump artefacts
? Compressing with the algorithm "GZ"
    > Warning: the extension "zlib" will now be required to execute the PHAR
? Setting file permissions to 0755
* Done.

No recommendation found.
No warning found.

 // PHAR: 916 files (987.43KB)
 // You can inspect the generated PHAR with the "info" command.

 // Memory usage: 20.52MB (peak: 21.40MB), time: 1sec


The documentation for PHP Reflect 4.2 is available in English to read it online or download to read it later (multiple formats).

AsciiDoc source code are available on docs folder of the repository.


  • Laurent Laville (Lead Dev)
  • Thanks to Nikita Popov who wrote a marvellous PHP Parser and simplify the job of PHP Reflect.
  • Thanks also to Remi Collet, a contributor of first hours.


This project is licensed under the BSD-3-Clause License - see the LICENSE file for details