sebastianbergmann

sebastianbergmann/object-reflector

PHP BSD-3-Clause Dev Tools

Allows reflection of object attributes, including inherited and non-public ones

6.3k stars
3 forks
recent
GitHub

6.3k

Stars

3

Forks

1

Open issues

5

Contributors

6.0.0 06 Feb 2026

AI Analysis

This is a PHP utility library that enables deep reflection of object properties, including private, protected, and inherited attributes that are normally inaccessible through standard PHP reflection. It is purpose-built for testing frameworks, debugging tools, and development utilities that need introspection capabilities beyond PHP's native reflection API—primarily benefiting test harness developers and library authors, not general application developers.

Dev Tools Library Discovery value: 4/10
Documentation 7/10
Activity 10/10
Community 8/10
Code quality 8/10

Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.

Overall score 8/10

AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.

php-reflection object-introspection testing-utility property-access developer-tool
Actively maintained Niche/specialized use case Well documented Production ready
Deep Analysis · Based on README and public signals
2w ago

PHP utility library for reflecting private and inherited object properties, a quiet backbone of PHPUnit

sebastian/object-reflector is a small, focused PHP library that exposes all attributes of an object — including private, protected, and inherited ones — beyond what PHP's native ReflectionClass conveniently surfaces. It was built by Sebastian Bergmann primarily as an internal dependency of PHPUnit and related testing infrastructure. Its high download count on Packagist is almost entirely driven by PHPUnit's massive ecosystem adoption rather than direct end-user choice. It matters because PHPUnit's diff, export, and comparison subsystems depend on it to accurately inspect objects during test assertions.

Origin

Created in March 2017 by Sebastian Bergmann as part of a broader decomposition of PHPUnit's internal utilities into standalone, versioned Composer packages. It has followed PHPUnit's versioning cadence closely ever since.

Growth

Star count of 6,284 with only 3 forks is a classic indirect-adoption signature: developers star it while exploring PHPUnit's dependency tree, not because they adopt it independently. Actual download growth tracks PHPUnit adoption globally. The 2 stars gained in the last 7 days confirm it is not a trending discovery project — growth is slow and steady, driven entirely by PHPUnit's installed base.

In production

Indirectly, this library is one of the most widely deployed PHP packages in existence — it is a transitive dependency of PHPUnit, which has hundreds of millions of Composer installs. Direct intentional adoption by end-users outside the PHPUnit ecosystem is not documented in the README and appears minimal, but indirect production usage is extremely broad.

Code analysis
Architecture

Likely a minimal single-class library (ObjectReflector) that iterates over an object's class hierarchy using PHP's native ReflectionClass, collecting properties at each level to handle shadowed and overridden attributes. Appears to be intentionally scoped to one responsibility.

Tests

Codecov badge is present in the README, suggesting automated coverage tracking is active. Exact coverage percentage is not stated in the README excerpt, but CI badge indicates tests run on every push.

Maintenance

Last push was 2026-06-23, just 4 days before the evaluation date — the project is actively maintained. Maintenance cadence appears to follow PHPUnit release cycles, with updates likely triggered by PHP version support changes or PHPUnit compatibility bumps rather than new features.

Honest verdict

ADOPT IF: you are building testing tooling, serialization, or debugging utilities in PHP that need to reliably enumerate all object properties across inheritance hierarchies without writing your own ReflectionClass recursion. AVOID IF: you need to access or mutate object properties at runtime in production application code — this is not designed as a general-purpose property accessor and carries the risks of coupling to internal object state. MONITOR IF: you maintain a PHP library that already vendors this as a transitive PHPUnit dependency and want to track whether future PHP versions or PHPUnit major versions alter its API.

Independent dimensions

Mainstream potential

2/10

Technical importance

5/10

Adoption evidence

8/10

Risks
  • Extreme dependency concentration: nearly all real-world usage flows through PHPUnit, so any breaking change in PHPUnit's dependency strategy would instantly affect this package's relevance.
  • PHP version evolution may reduce the need for this abstraction if future PHP releases add better native APIs for inherited private property introspection.
  • The library's minimal scope means it will rarely receive feature development — developers who need richer reflection behavior may need to supplement or replace it.
  • Low fork count (3) suggests minimal community involvement outside the maintainer; bus-factor is effectively 1.
  • Semantic versioning changes in major releases (e.g., v1 to v2 to v3) have historically broken compatibility for projects pinning older PHPUnit versions, requiring multi-version constraint management.
Prediction

This library will continue to exist as a stable, low-churn infrastructure component as long as PHPUnit depends on it. No meaningful independent adoption growth is expected — it will remain a well-maintained internal utility.

0 found this helpful

Newsletter

Get analyses like this every Monday

Free weekly digest of the most interesting open-source discoveries.

Languages

PHP
100%

Information

Language
PHP
License
BSD-3-Clause
Last updated
1w ago
Created
114mo ago
Analyzed with
anthropic/claude-haiku-4-5

Stars over time

Loading…

Contributors over time

Top 100 contributors only — repos with more will plateau at 100.

Loading…

Open pull requests

No open pull requests.

Similar repos

Roave

Roave/BetterReflection

Better Reflection is a static analysis-focused reflection API for PHP that...

1.2k PHP Dev Tools
sebastianbergmann

sebastianbergmann/object-enumerator

A PHP library that traverses array structures and object graphs to enumerate...

6.5k PHP Dev Tools
phpDocumentor

phpDocumentor/ReflectionCommon

ReflectionCommon is a PHP library providing shared reflection interfaces and...

9.1k PHP Dev Tools
sebastianbergmann

sebastianbergmann/type

A PHP library providing typed value objects that represent the PHP type...

1.5k PHP Dev Tools
sebastianbergmann

sebastianbergmann/environment

This PHP library provides utilities for detecting and handling runtime-specific...

6.8k PHP Dev Tools
vs. alternatives
PHP native ReflectionClass

The built-in ReflectionClass requires manual recursion through parent classes to collect inherited private properties; this library wraps that complexity into a single call. Not really a competitor — more of a convenience layer over it.

phpDocumentor/ReflectionCommon

ReflectionCommon focuses on PHP element reflection for documentation and static analysis purposes. Different use case — that library models code structure; this one inspects live object state at runtime.

sebastianbergmann/object-enumerator

A sibling package in the same ecosystem. object-enumerator traverses object graphs to enumerate all objects; object-reflector is used as a building block within that process to extract properties.

symfony/property-access

Symfony's property-access component reads and writes object properties via a path-based API, often with getter/setter awareness. Serves a different use case (data access) rather than complete attribute introspection for inspection/comparison.

ocramius/proxy-manager (GeneratorStrategy)

Some proxy-based tools need deep object introspection, but they operate at the proxy generation level. Not a direct alternative — this library is narrower and lighter.