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'));
?>
See Also
- Introduction to PHP Reflection API
- Understanding PHP Reflection: An In-Depth Guide with Examples
- Rewriting reflexion with Rust
Related
- Class
- instance
- Introspection
- get_object_vars()
- new
- ReflectionException
- Writeable
- get_class_vars()
- Reflector
- Code Generation
- Homoiconicity
- Meta-object Protocol (MOP)
- Metaclass
- Metaprogramming