Download the PHP package phpdocumentor/reflection without Composer

On this page you can find all versions of the php package phpdocumentor/reflection. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package reflection

License: MIT Qa workflow Coveralls Coverage Scrutinizer Code Coverage Scrutinizer Code Quality Stable Version Unstable Version

Reflection

Using this library it is possible to statically reflect one or more files and create an object graph representing your application's structure, including accompanying in-source documentation using DocBlocks.

The information that this library provides is similar to what the (built-in) Reflection extension of PHP provides; there are however several advantages to using this library:

Features

Installation

In order to inspect a codebase you need to tell composer to include the phpdocumentor/reflection package. This can easily be done using the following command in your command line terminal:

composer require phpdocumentor/reflection:~5.0

After the installation is complete no further configuration is necessary and you can immediately start using it.

Basic Usage

This Reflection library uses PSR-4 and it is recommended to use a PSR-4 compatible autoloader to load all the files containing the classes for this library.

An easy way to do this is by including the composer autoloader as shown here:

include 'vendor/autoload.php';

Once that is done you can use the createInstance() method of the \phpDocumentor\Reflection\Php\ProjectFactory class to instantiate a new project factory and pre-configure it with sensible defaults. Optional you can specify the parser version that shall be used as an argument of createInstance(). By default the php7 parser is prefered. And php5 is used as a fallback. See the documentation of phpparser for more info.

$projectFactory = \phpDocumentor\Reflection\Php\ProjectFactory::createInstance();

At this point we are ready to analyze your complete project or just one file at the time. Just pass an array of file paths to the create method of the project factory.

$projectFiles = [new \phpDocumentor\Reflection\File\LocalFile('tests/example.file.php')];
$project = $projectFactory->create('My Project', $projectFiles);

When the process is ready a new object of type phpDocumentor\Reflection\Php\Project will be returned that contains a complete hierarchy of all files with their classes, traits and interfaces (and everything in there), but also all namespaces and packages as a hierarchical tree.

See the example script for a detailed and commented example


All versions of reflection with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|8.0.*|8.1.*|8.2.*|8.3.*
nikic/php-parser Version ~4.14
phpdocumentor/reflection-common Version ^2.1
phpdocumentor/reflection-docblock Version ^5
phpdocumentor/type-resolver Version ^1.2
symfony/polyfill-php80 Version ^1.28
webmozart/assert Version ^1.7
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package phpdocumentor/reflection contains the following files

Loading the files please wait ....