CHAPTER 7Reflection API

Reflection is one of the most powerful and perhaps one of the most underused features of the PHP language. If you're tasked with building complex, extensible applications, it's well worth your time to understand this powerful feature. Reflection can facilitate otherwise tedious and complicated tasks, such as autoloading plug-ins, automating documentation, and even extending the PHP language itself.

How can one feature offer such a wide array of capabilities? PHP's reflection API consists of a series of classes that allow you to access program metadata and interact with associated code comments. This gives you the ability to determine, for example, what methods a class implements. With this capability, you can create applications ...

Get Pro PHP: Patterns, Frameworks, Testing and More now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.