Reflect may be installed in several ways, choose your favorite.

Please read the migration guide in case you are upgrading from a version 1.x of PHP Reflect.


Before you install PHP Reflect, you will need an operating system with PHP 5.4.0 or later installed,

Reflect requires the date, json, reflection, tokenizer, phar, pcre, and spl extensions. These extensions are usually compiled and enabled by default.


Put a file named composer.json at the root of your project, with the content below:

    "require": {
        "bartlett/php-reflect": "4.2.2"

And ask Composer to install the dependencies:

$ php composer.phar install

Or just invoke Composer to install the latest version:

$ php composer.phar require bartlett/php-reflect

With composer install or create-project commands, if you want to disable installation of require-dev packages (doctrine/cache, psr/log, monolog/monolog, bartlett/phpunit-loggertestlistener), don’t forget to specify the --no-dev option.

You can also use Composer to create a new project from an existing Reflect package. This is the equivalent of doing a git clone checkout followed by a composer install of the vendors.

$ php composer.phar create-project bartlett/php-reflect /path/to/install 4.2.2

Where /path/to/install is your install directory.


The recommended way for newbies, or just to have a look on features of this library, is to download a PHP Archive that contain all required dependencies of PHP Reflect bundled in a single file.

$ wget
$ chmod +x phpreflect-4.2.2.phar
$ mv phpreflect-4.2.2.phar /usr/local/bin/phpreflect
$ phpreflect

You can also immediately use the PHAR after you have downloaded it.

$ wget
$ php phpreflect-4.2.2.phar