2017 © Pedro PelĂĄez
 

library better-reflection

Better Reflection - an improved code reflection API

image

roave/better-reflection

Better Reflection - an improved code reflection API

  • Tuesday, July 31, 2018
  • by Ocramius
  • Repository
  • 31 Watchers
  • 564 Stars
  • 63,319 Installations
  • PHP
  • 53 Dependents
  • 3 Suggesters
  • 53 Forks
  • 30 Open issues
  • 22 Versions
  • 40 % Grown

The README.md

Better Reflection

Mutation testing badge Type Coverage Latest Stable Version License, (*1)

Better Reflection is a reflection API that aims to improve and provide more features than PHP's built-in reflection API., (*2)

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
  • 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
  • Moar stuff coming soon!

Typically you would use Better Reflection for static analysis tooling. It can serve as a baseline to access type information (e.g. doc blocks, type declarations), method/function body AST fetching etc. for static analysis., (*3)

Better Reflection is NOT suited to runtime usage, since performance is much worse than PHP built-in reflection. If you do not want to do anything that native PHP reflection can't do, then just use native PHP reflection! The "Better" in Better Reflection refers to feature, not speed!, (*4)

Be sure to read more in the feature documentation., (*5)

Installation

Require using composer:, (*6)

composer require roave/better-reflection

Usage

<?php

use Roave\BetterReflection\BetterReflection;

$classInfo = (new BetterReflection())
    ->reflector()
    ->reflectClass(\Foo\Bar\MyClass::class);

Documentation

Upgrading

Please refer to the Upgrade Documentation documentation to see what is required to upgrade your installed BetterReflection version., (*7)

Limitations

  • PHP cannot autoload functions, therefore we cannot statically reflect functions

License

This package is released under the MIT license., (*8)

Contributing

If you wish to contribute to the project, please read the CONTRIBUTING notes., (*9)

The Versions

31/07 2018
31/07 2018
23/07 2018
29/05 2018

dev-feature/better-exception-for-unresolvable-constant-references

dev-feature/better-exception-for-unresolvable-constant-references

Better Reflection - an improved code reflection API

  Sources   Download

MIT

The Requires

 

The Development Requires

26/05 2018

3.0.x-dev

3.0.9999999.9999999-dev

Better Reflection - an improved code reflection API

  Sources   Download

MIT

The Requires

 

The Development Requires

26/05 2018
05/02 2018

2.0.x-dev

2.0.9999999.9999999-dev

Better Reflection - an improved code reflection API

  Sources   Download

MIT

The Requires

 

The Development Requires

05/02 2018
01/11 2017
16/10 2017

dev-implement-newInstanceArgs

dev-implement-newInstanceArgs

Better Reflection - an improved code reflection API

  Sources   Download

MIT

The Requires

 

The Development Requires

16/09 2017
31/08 2017

dev-feature/entry-point

dev-feature/entry-point

Better Reflection - an improved code reflection API

  Sources   Download

MIT

The Requires

 

The Development Requires

31/08 2017

dev-feature/use-php-parser-directly-as-a-source-stubber

dev-feature/use-php-parser-directly-as-a-source-stubber

Better Reflection - an improved code reflection API

  Sources   Download

MIT

The Requires

 

The Development Requires

30/08 2017

dev-feature/memoize-parsing

dev-feature/memoize-parsing

Better Reflection - an improved code reflection API

  Sources   Download

MIT

The Requires

 

The Development Requires

19/08 2017

dev-feature/cached-locator

dev-feature/cached-locator

Better Reflection - an improved code reflection API

  Sources   Download

MIT

The Requires

 

The Development Requires

07/05 2017

dev-resolve-nullable-iterable-php71-types

dev-resolve-nullable-iterable-php71-types

Better Reflection - an improved code reflection API

  Sources   Download

MIT

The Requires

 

The Development Requires

31/03 2017

dev-php7-updates

dev-php7-updates

Better Reflection - an improved code reflection API

  Sources   Download

MIT

The Requires

 

The Development Requires

26/09 2016

1.2.0

1.2.0.0

Better Reflection - an improved code reflection API

  Sources   Download

MIT

The Requires

 

The Development Requires

25/07 2016

1.1.0

1.1.0.0

Better Reflection - an improved code reflection API

  Sources   Download

MIT

The Requires

 

The Development Requires

07/02 2016

1.0.1

1.0.1.0

Better Reflection - an improved code reflection API

  Sources   Download

MIT

The Requires

 

The Development Requires

04/02 2016

1.0.0

1.0.0.0

Better Reflection - an improved code reflection API

  Sources   Download

MIT

The Requires

 

The Development Requires