# Roave/BetterReflection

:crystal_ball: Better Reflection is a reflection API that aims to improve and provide more features than PHP's built-in reflection API.

Repository: https://github.com/Roave/BetterReflection
Canonical: https://ross.abutalabs.com/products/betterreflection
Language: PHP
License: MIT
License Family: permissive
Topics: hacktoberfest
Last push: 2026-09-02T21:44:02+00:00

## Health v2 (maintenance only)
Score: 98/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 100, release rhythm 94, longevity 100
- inputs: {"age_days": 4108, "days_push": 0, "days_rel": 42, "gap_med": 9.0, "n_releases_24m": 31}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1247, forks 138 (observed 2026-09-03T02:15:08.013671+00:00)

## What it is
Better Reflection is a PHP library providing an enhanced reflection API that can reflect on classes not yet loaded, from code strings, and expose ASTs of methods and functions. It is designed primarily for static analysis tooling rather than runtime use, where native PHP reflection is faster.

## Use cases
- reflect on PHP classes without loading them
- extract AST from methods and functions
- analyze type declarations and doc blocks statically
- reflect on classes from a string of PHP code
- build static analysis or code quality tools
- inspect closures and return types in PHP 7 code

## When to choose
- building static analysis tooling in PHP
- you need type information or ASTs that native reflection cannot provide
- you must inspect code without triggering autoloading

## When to avoid
- runtime reflection in performance-sensitive applications
- you only need features native PHP reflection already offers
- you need to statically reflect on plain functions

## Facets
- artifact type: library
- maturity: active
- function: parser, developer-tools
- domain: developer-tools, programming-languages
- platform: php, cli
- tags: reflection, static-analysis, ast, php, code-introspection

## Member repositories
- Roave/BetterReflection (main) score 98

## Provenance
- Observed fields: from GitHub, fetched 2026-09-03T02:15:08.013671+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T05:08:01.294404+00:00, confidence not recorded.
  - readme: https://github.com/Roave/BetterReflection (fetched 2026-09-03T02:15:08.013671+00:00, sha 4c50574cd416)
- Data as of 2026-08-30T08:39:29.467469+00:00.
