PHPackages                             rector/better-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. rector/better-reflection

Abandoned → [roave/better-reflection](/?search=roave%2Fbetter-reflection)ArchivedLibrary

rector/better-reflection
========================

Better Reflection - an improved code reflection API

v4.0.0(8y ago)24.1k↑400%1MITPHPPHP ^7.1

Since Nov 2Pushed 8y ago1 watchersCompare

[ Source](https://github.com/deprecated-packages/BetterReflection)[ Packagist](https://packagist.org/packages/rector/better-reflection)[ RSS](/packages/rector-better-reflection/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (15)Used By (0)

Better Reflection
=================

[](#better-reflection)

[![Build Status](https://camo.githubusercontent.com/5839d8af16381b2822a2974f40f4a8bf45210b72a481fe98f2c31e6879102040/68747470733a2f2f7472617669732d63692e6f72672f526563746f722f4265747465725265666c656374696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Rector/BetterReflection) [![Build Status](https://camo.githubusercontent.com/0ce7085c7a20a39c20dce1cd37d1814e725807abc5e490d05723203acc88b3ce/68747470733a2f2f63692e6170707665796f722e636f6d2f6170692f70726f6a656374732f7374617475732f6769746875622f526563746f722f4265747465725265666c656374696f6e3f7376673d74727565266272616e63683d6d6173746572)](https://ci.appveyor.com/project/Ocramius/betterreflection-4jx2w) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/50de91e001bafea4a8e600131dbf3be4f0fbecb423a59fe6aeb3859b916c0ca4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f526563746f722f4265747465725265666c656374696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Rector/BetterReflection/?branch=master) [![Code Coverage](https://camo.githubusercontent.com/71771ca7dd039b991cfa65875916f27e9871a9bc0735e44bc7aa8e092ea25d41/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f526563746f722f4265747465725265666c656374696f6e2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Rector/BetterReflection/?branch=master) [![Latest Stable Version](https://camo.githubusercontent.com/caa8b2b327daa41392295fa3ed39b6c356b8a38808e4000c90b0454bf7993b00/68747470733a2f2f706f7365722e707567782e6f72672f726563746f722f6265747465722d7265666c656374696f6e2f762f737461626c65)](https://packagist.org/packages/rector/better-reflection) [![License](https://camo.githubusercontent.com/a0932ff5a2c950a57467f1864a2120bc7a06e599027777642dd6fda243f6ff19/68747470733a2f2f706f7365722e707567782e6f72672f726563746f722f6265747465722d7265666c656374696f6e2f6c6963656e7365)](https://packagist.org/packages/rector/better-reflection)

Better Reflection is a reflection API that aims to improve and provide more features than PHP's built-in [reflection API](http://php.net/manual/en/book.reflection.php).

Why is it better?
-----------------

[](#why-is-it-better)

- You can reflect on classes that are not already loaded, without loading them
- Ability to reflect on classes directly from a string of PHP code
- Better Reflection analyses the DocBlocks (using [phpdocumentor/type-resolver](https://github.com/phpDocumentor/TypeResolver))
- Reflecting directly on closures
- Ability to extract AST from methods and functions
- Ability to return AST representation of a class or function
- Fetch return type declaration and parameter type declarations in PHP 7 code (even when running PHP 5!)
- Change or remove PHP 7 parameter type and return type declarations from methods and functions
- Change the body of a function or method to do something different
- *Moar stuff coming soon!*

Be sure to read more in the [feature documentation](docs/features.md).

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

[](#installation)

Simply require using composer:

```
$ composer require rector/better-reflection
```

Usage
-----

[](#usage)

```
