PHP Classes

Advanced Sourcecode Reflection in PHP: Retrieve extended class reflection information

Recommend this page to a friend!
  Info   Screenshots Screenshots   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 69%Total: 883 This week: 1All time: 3,991 This week: 560Up
Version License PHP version Categories
advanced-reflection 1.0.0GNU Lesser Genera...5.2.2PHP 5, Language
Description 

Author

This package can retrieve extended reflection information on classes or functions.

It can extends the reflection classes and parses PHP source code to retrieve additional details on classes and functions.

Currently it returns the body of their code, the declaration, the line, column and file position in the source file, besides other details that can be retrieved by the base reflection support.

Innovation Award
PHP Programming Innovation award nominee
April 2011
Number 2


Prize: One copy of RadPHP XE
PHP 5 introduced reflection support in PHP, thus allowing applications to introspect PHP classes at runtime and do something useful with classes meta-information.

This class goes further by parsing the actual PHP source code to provide additional useful meta-information details besides what PHP reflection support provides.

Manuel Lemos
Picture of Artur Graniszewski
  Performance   Level  
Name: Artur Graniszewski is available for providing paid consulting. Contact Artur Graniszewski .
Classes: 14 packages by
Country: Poland Poland
Age: 42
All time rank: 2874 in Poland Poland
Week rank: 106 Up5 in Poland Poland Down
Innovation award
Innovation award
Nominee: 7x

Winner: 1x

Details

To use this library simplycreate instances of: * AdvancedReflectionClass, * AdvancedReflectionMethod, * AdvancedReflectionFunction, These are extending the ReflectionClass, ReflectionMethod and ReflectionFunction built in the PHP 5.x, so they are equipped with all the methods from the original Reflection PHP mechanism and additional ones: * getBody() returns source code (string) containing main body of the class/method/function * getDeclaration() returns source code (string) containing entire declaration of the class/method/function * getStartColumn() returns starting column number (integer) of the class/method/function in the starting line of code (getStartLine()). * getStartPosition() returns position (integer) of the first character of the class/method/function in the sourcecode file Example taken from the PHP manual and modified for this library: <?php namespace A\B; class Foo { public $test; } $function = new \System\Reflection\AdvancedReflectionClass('A\\B\\Foo'); var_dump($function->inNamespace()); var_dump($function->getName()); var_dump($function->getNamespaceName()); var_dump($function->getDeclaration()); ?> See examples files for futher info.

Screenshots  
  • example1.PNG
  Files folder image Files  
File Role Description
Plain text file reflection_php53.php Class Main class (PHP 5.3+ only)
Plain text file reflection_php52.php Class Main class (PHP 5.2+)
Accessible without login Plain text file example_php53.php Example Example #1 (PHP 5.3+ only)
Accessible without login Plain text file example_php52.php Example Example #2 (PHP 5.2+)
Accessible without login Plain text file license.txt Lic. LGPL license
Accessible without login Plain text file readme.txt Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 0%
Total:883
This week:1
All time:3,991
This week:560Up
 User Ratings  
 
 All time
Utility:91%StarStarStarStarStar
Consistency:83%StarStarStarStarStar
Documentation:79%StarStarStarStar
Examples:79%StarStarStarStar
Tests:-
Videos:-
Overall:69%StarStarStarStar
Rank:311