Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Peek And Poke Laravel Package

sebastian/peek-and-poke

sebastian/peek-and-poke is a small PHP utility that uses reflection to peek at and poke into objects. It lets you read and write private and protected properties, making it handy for tests that need to inspect or set up object state without changing production code.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Test-strategy decisions for legacy or tightly encapsulated code. This package lets tests read private/protected properties and invoke non-public methods via a reflection-based proxy. That directly informs the choice between "refactor first, then test" and "characterize behaviour now, refactor later" — a recurring roadmap trade-off in any mature PHP codebase.
  • Tech-debt and refactoring prioritization. Frequency of need is itself a signal: if engineers reach for this often, the code lacks test seams and dependency-injection boundaries. That is a quantifiable input for where to schedule encapsulation work.
  • Build-vs-buy (really build-vs-vendor) for internal tooling. The entire capability is a thin wrapper over PHP's ReflectionClass/ReflectionMethod — roughly a few dozen lines. The real decision is whether to carry a third-party dev dependency or own a small internal test helper.
  • Use cases it enables: white-box assertions during a PHPUnit migration, characterization tests before a rewrite, debugging non-public state in test fixtures, and asserting invariants on value objects that expose no getters.
  • What it does not support: no user-facing feature, no runtime/roadmap impact, no architecture decision. It is strictly a require-dev concern and should never appear in production dependency graphs.

When to Consider This Package

Consider it when:

  • You are mid-migration on a PHPUnit-based suite and need temporary white-box access to unblock coverage on a legacy module.
  • The dependency stays in require-dev, the PHP version is compatible, and you accept an unmaintained artifact.
  • You want a known, battle-tested-by-pedigree implementation (same author as PHPUnit) rather than a hand-rolled reflection helper.

Look elsewhere — or copy the pattern — when:

  • Maintenance matters. The repository is archived. There will be no PHP-version compatibility fixes; a future PHP release that changes reflection semantics strands you.
  • Licensing/procurement is involved. The license is reported as NOASSERTION. For a 36-star archived package with zero dependents, the legal review cost exceeds the value of the code; this alone typically blocks adoption in enterprise environments.
  • You need ecosystem validation. Zero dependents means no downstream proof it works in real projects, and no community to surface issues.
  • Better alternatives fit: PHPUnit's built-in constraints and fixtures, direct ReflectionClass usage in tests, or — preferably — a design change (extract collaborators, introduce interfaces, or expose @internal accessors for tests). If you are testing private methods heavily, the higher-leverage answer is usually refactoring, not tooling.
  • Anyone proposes it for production code. Hard no; it defeats encapsulation and adds runtime risk for zero product benefit.

How to Pitch It (Stakeholders)

To executives: This is a tiny, test-only PHP utility — not a platform bet. It has no runtime footprint and no product impact. Because it is archived and carries an unclear license, my recommendation is not to adopt it as a dependency; the capability is small enough to replicate internally in under an hour, eliminating the maintenance and legal overhead entirely.

To engineering: It is a reflection wrapper that grants tests access to private state and methods. Useful as a temporary bridge during legacy modernization, but the same behaviour is a few dozen lines over ReflectionClass. Vendor a small internal helper instead: same capability, our license, our maintenance, and no unmaintained transitive dependency. If you find yourself using it more than occasionally, treat that as a signal to invest in test seams and encapsulation rather than in the tool.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
unabomber/timezone
delatbabel/contacts
astritzeqiri/g-recaptcha
kevinongko/laravel-genode
developeruz/laravel-analytics
robbiep/afterthedeadline
frankkessler/incontact-laravel-oauth2-rest
jlxh/laravel-userlog
davidmgilo/timetables
qylinfly/role-permission
reflect-digital/conduit
takashato/laravel-vietqr
aitor24/laralang
kraenzle-ritter/entity-relations
dindigital/din-image
pomirleanu/image-colors
sawmainek/laravel-api-generator
delatbabel/jsonresponses
mouhamedfd/permissions-generator
eduplus/qr