PHPackages                             tbn/getter-trait-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. tbn/getter-trait-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

tbn/getter-trait-bundle
=======================

4.1.0(10mo ago)25.5k↓66.7%1MITPHPPHP ^8.2CI passing

Since Aug 23Pushed 3w ago1 watchersCompare

[ Source](https://github.com/thomasbeaujean/getter-trait-bundle)[ Packagist](https://packagist.org/packages/tbn/getter-trait-bundle)[ RSS](/packages/tbn-getter-trait-bundle/feed)WikiDiscussions main Synced yesterday

READMEChangelog (4)Dependencies (9)Versions (11)Used By (0)

Getter and Setter Generator
===========================

[](#getter-and-setter-generator)

Symfony Bundle that generates getters and setters inside a trait.

Why ? Basics getters brings no information about the class.

The classes are quickly long for no "business" reason.

Having only the redefined method allows to spot the method with business purpose.

Installation
============

[](#installation)

```
composer require --dev "tbn/getter-trait-bundle"
```

In `config/bundles.php`, add the bundle to the dev environment

```
return [
    ...
    tbn\GetterTraitBundle\GetterTraitBundle::class => ['dev' => true,],
];
```

Usage
=====

[](#usage)

Add the `GetSetTrait` attribute to your class
---------------------------------------------

[](#add-the-getsettrait-attribute-to-your-class)

```
use tbn\GetterTraitBundle\Attributes\GetSetTrait; // add this line

#[GetSetTrait] // add this line
class MyClass
{
    private String $name;
}
```

Run the `./bin/console generate:getter:traits` command
------------------------------------------------------

[](#run-the-binconsole-generategettertraits-command)

A new file is automatically generated in the same folder and contains the getters and setters for the `MyClass` class.

> When a property is modified or added, you have to re-run the command in order to update the traits.

Use the generated trait.
------------------------

[](#use-the-generated-trait)

```
#[GetSetTrait]
class MyClass
{
    use MyClassTrait; // add this line

    private String $name;
}
```

I need to redefine the method
-----------------------------

[](#i-need-to-redefine-the-method)

Just copy/paste the generated code inside your class and update it to your needs.

More examples
=============

[](#more-examples)

[Example folder](./tests/src/Entity)

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance77

Regular maintenance activity

Popularity26

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 86.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~145 days

Recently: every ~181 days

Total

6

Last Release

318d ago

Major Versions

1.1.0 → 2.0.02024-03-06

2.0.0 → 3.002024-07-03

3.00 → 4.0.02024-12-24

PHP version history (3 changes)1.0.0PHP &gt;=8.0

1.1.0PHP ^8.1

3.00PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/7ea8a2617988a793aef214fa41de59c562bd141343046102e6bf87d6db4cc354?d=identicon)[thomasbeaujean](/maintainers/thomasbeaujean)

---

Top Contributors

[![thomasbeaujean](https://avatars.githubusercontent.com/u/5817919?v=4)](https://github.com/thomasbeaujean "thomasbeaujean (33 commits)")[![lbaey-hw](https://avatars.githubusercontent.com/u/203635594?v=4)](https://github.com/lbaey-hw "lbaey-hw (5 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tbn-getter-trait-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tbn-getter-trait-bundle/health.svg)](https://phpackages.com/packages/tbn-getter-trait-bundle)
```

###  Alternatives

[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.4k67.4M263](/packages/nelmio-api-doc-bundle)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M508](/packages/pimcore-pimcore)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1616.4k14](/packages/2lenet-crudit-bundle)[oro/platform

Business Application Platform (BAP)

645143.5k115](/packages/oro-platform)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
