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

Getter Trait Bundle Laravel Package

tbn/getter-trait-bundle

tbn/getter-trait-bundle provides reusable PHP traits for adding getter methods to your classes. It reduces boilerplate, keeps property access consistent, and works smoothly in Laravel or standalone PHP projects.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

What it appears to be: tbn/getter-trait-bundle is a Symfony bundle (the -bundle suffix and tbn vendor namespace indicate Symfony, not Laravel) that ships PHP traits intended to supply getter methods to classes — most plausibly entity/DTO/value-object classes. Assessment below is based on package metadata and naming conventions; source review is a prerequisite before any adoption decision, since documentation and community signal are effectively absent.

Architecture fit: Low architectural weight by design. Traits are compile-time inclusions with no container services, no kernel event listeners assumed, and no persistence coupling. That makes it a leaf dependency in the domain layer rather than an infrastructure concern — attractive from a coupling standpoint. However, the fit is conditional on the consuming application being Symfony. If the target stack is Laravel, a Symfony bundle is a stack mismatch: bundles depend on symfony/http-kernel and the bundle registration lifecycle, which Laravel does not provide. In a Laravel context, only the underlying trait files could be copied out, at which point you are maintaining a fork rather than consuming a package.

Integration feasibility: Mechanically trivial — composer require, register the bundle in config/bundles.php (likely no Flex recipe given the adoption level), and use the trait in target classes. Blast radius is opt-in per class, which is the strongest argument in its favor: adoption can be trialed on a single DTO and reverted with one line. The real feasibility question is not "can we install it" but "does it behave correctly inside our existing serialization and ORM pipeline."

Technical risk: High, and concentrated in maintenance rather than runtime. Two stars and zero dependents means no production validation signal, no third-party bug reports, and no ecosystem pressure to keep it current with Symfony majors. Single-maintainer bus factor of one. Specific technical unknowns: whether getters are generated via reflection at runtime or resolved statically; interaction with typed/readonly properties under PHP 8.1+; collision behavior when a class already declares a getter; compatibility with Symfony's PropertyAccess, ObjectNormalizer, and Doctrine hydration, all of which probe accessors reflectively and can be sensitive to magic __call-based implementations. Supply-chain risk is low in absolute terms (small surface, MIT, no network or filesystem code expected) but non-zero given an unvetted maintainer.

Key questions to resolve before commitment:

  1. Which Symfony and PHP version constraints are declared in composer.json, and is the 2025-09-19 release a compatibility bump or a feature release?
  2. Does the package generate real methods, use __call, or rely on reflection? This determines static-analysis and IDE support.
  3. Does it support typed properties, constructor promotion, and readonly?
  4. What happens on a method-name collision — silent override, fatal error, or skip?
  5. Is there a test suite, and what is its coverage of edge cases?
  6. Is the license header present in source files (MIT declared, but verify per-file)?

Integration Approach

Stack fit: Approved only for Symfony applications on a PHP version explicitly covered by the package's constraints. For Laravel or framework-agnostic PHP codebases, treat this as source material, not a dependency — vendor the trait files with attribution and own them internally. That converts an unmaintained dependency into ~50 lines of code you control, which is almost certainly the correct trade for a package of this size.

Migration path: Effectively zero-risk. Adoption is additive (use SomeGetterTrait;), carries no schema, config, or data migration, and rollback is deletion of the trait usage plus composer remove. No forward migration burden is created — the codebase remains valid without the package.

Compatibility: Verify in a scratch Symfony app before touching production code. Run composer why-not against the target framework version, then exercise the trait against a representative entity through the serializer and Doctrine to confirm accessor discovery still works. Run PHPStan or Psalm at the project's existing level to confirm the trait does not degrade static analysis — this is the most likely failure point.

Sequencing:

  1. Spike (0.5 day): read the bundle source end to end, confirm mechanism (reflection vs. codegen vs. __call).
  2. Sandbox validation (0.5 day): install in a throwaway Symfony skeleton, apply to one DTO, test serialization and ORM hydration.
  3. Pilot (1 day): apply to a single low-traffic entity in a feature branch; run static analysis and full test suite.
  4. Decision gate: if the spike reveals reflection-based magic or absent test coverage, stop and vendor the trait instead.
  5. Rollout: only after the gate passes, expand to remaining DTOs with a lint rule or code-review checklist to prevent inconsistent usage.

Operational Impact

Maintenance: The dominant cost. With two stars and zero dependents, expect to be the de facto maintainer. Budget for a source audit at each Symfony major upgrade and a contingency plan to fork. The effective cost per line of value delivered is poor — this package replaces boilerplate getters, work that modern IDEs and PHP 8 constructor promotion largely eliminate already.

Support: No community, no issue history of substance, no Stack Overflow corpus. Support means reading source. Acceptable only if the team has a PHP developer comfortable with traits and Symfony bundle internals; unacceptable if the team will file tickets into a void.

Scaling: Runtime impact is likely negligible if traits are compile-time includes. If getters resolve through __call or reflection on every invocation, there is a per-call cost that will show up in hot paths (serialization of large collections, API list endpoints). Benchmark before wide adoption; do not assume.

Failure modes, ranked:

  1. Silent abandonment — package stops receiving Symfony compatibility updates, blocking a framework upgrade. Highest probability, highest impact.
  2. Method collision — trait getter conflicts with an existing or future method, producing a fatal error at class load or a silent override that changes behavior.
  3. Serialization regression — getters exposed or hidden unexpectedly by ObjectNormalizer, altering API response shape. Detected only by contract tests.
  4. Static analysis degradation — magic methods invisible to PHPStan/Psalm, reducing type safety across the domain layer.
  5. Doctrine hydration mismatch — accessor-based mapping behaving differently than direct property access.

Ramp-up: Near zero for anyone who knows PHP traits — one trait import, no configuration, no runtime concept to learn. The real ramp-up cost is organizational: someone must own the decision to depend on an unmaintained package, document why, and monitor it. Assign that owner explicitly or the dependency will drift unmanaged.

TPM recommendation: Do not adopt as a runtime dependency. Either vendor the trait source internally (preserving the MIT notice) or, more likely, close the requirement — PHP 8 constructor promotion and IDE generation already solve the stated problem with zero dependency risk. The package is technically harmless and architecturally clean, but its adoption signal is too thin to justify a supply-chain commitment for boilerplate elimination.

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.
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route