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
Reflection Property Test

Reflection Property Test Laravel Package

gollumsf/reflection-property-test

A lightweight PHP testing helper for asserting on class properties via reflection. Inspect and verify private and protected property values in unit and feature tests, keeping assertions concise, readable, and easy to maintain.

Deep Wiki
Context7

Add trait for reflection data

Frequently asked questions about Reflection Property Test
What is gollumsf/reflection-property-test used for?
It is a lightweight PHP testing helper for Laravel tests that lets you inspect and assert on private and protected class properties via reflection. It is useful when behavior depends on internal state that is not exposed through public methods. The goal is to keep these assertions concise and readable instead of writing reflection boilerplate in every test.
How do I install gollumsf/reflection-property-test in a Laravel project?
Install it with Composer as a development dependency using composer require gollumsf/reflection-property-test --dev. Because it is a testing helper, it should normally stay out of production dependencies. After installation, add the provided trait to the test classes where you need reflection-based property assertions.
Does it work in Laravel feature tests as well as unit tests?
Yes, the package is described as suitable for both unit and feature tests. It works in PHPUnit-style test classes, including Laravel's testing setup. Use it when you need to verify private or protected state after exercising application code.
How do I assert a private property value using the trait?
Add the package's trait to your test class, then use its reflection helper to read the property and compare it with the expected value. The exact method names should be confirmed from the package README or source code. This avoids manually setting up ReflectionProperty in each test.
Which Laravel and PHP versions are supported?
The provided package context does not list explicit Laravel or PHP version constraints. Check the package's composer.json and Packagist metadata for its require and require-dev constraints before adopting it. If your versions are not declared as supported, test the package on a branch first.
Is any configuration required after installing the package?
No configuration is described in the package overview; it is a trait-based testing helper. You typically just import and use the trait in your test classes. If the package offers customization options, they should be documented in the README.
Can it inspect protected properties as well as private ones?
Yes, the package blurb states that it inspects and verifies private and protected property values. Reflection can access both when configured correctly. This is helpful for testing state stored in parent classes or internal services.
Should this package be used in production code?
No, it is a testing helper and should be installed as a dev dependency. It has no role in application runtime behavior. Keeping it in require-dev prevents it from being shipped as part of production dependencies.
What are alternatives to using a reflection assertion package?
You can use PHP's native ReflectionClass and ReflectionProperty APIs directly, or expose state through public getters where that makes sense. PHPUnit's older attribute assertions have been deprecated or removed, so many teams write small custom helpers instead. This package mainly reduces boilerplate for those reflection checks.
How is the package maintained and is it safe to rely on?
The provided context does not include release history, issue tracker status, or maintainer activity. Review the repository and Packagist page for recent commits, tagged releases, and open issues before adopting it. Because it is a dev-only dependency, its risk is generally limited to your test suite.
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.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons