Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Reflection

PHP reflection is a feature that allows to inspect and interact with the structure of classes, interfaces, methods, properties, and other elements of the code, during runtime. Reflection is made possible by the Reflection API, which provides a set of classes and functions for introspecting objects and classes.

PHP offers a complete API to describe classes, methods, interfaces, constants, functions, extensions, traits, enums and their components.

  • ReflectionAttribute
  • ReflectionClass
  • ReflectionClassConstant
  • ReflectionEnum
  • ReflectionEnumBackedCase
  • ReflectionEnumUnitCase
  • ReflectionException
  • ReflectionExtension
  • ReflectionFiber
  • ReflectionFunction
  • ReflectionFunctionAbstract
  • ReflectionGenerator
  • ReflectionIntersectionType
  • ReflectionMethod
  • ReflectionNamedType
  • ReflectionObject
  • ReflectionParameter
  • ReflectionProperty
  • ReflectionReference
  • ReflectionType
  • ReflectionUnionType
  • ReflectionZendExtension
  • Reflector

Reflection is also available in other programming languages.

<?php

   Reflection::export(new ReflectionClass('Exception'));

?>

Documentation

See Also