PHPackages                             alexanevsky/getter-setter-accessor-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. alexanevsky/getter-setter-accessor-bundle

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

alexanevsky/getter-setter-accessor-bundle
=========================================

Provides functions to read and write from/to an object and gets the list of object getters and setters.

1.0.4(1y ago)12702MITPHPPHP &gt;=8.1

Since Mar 24Pushed 1y ago1 watchersCompare

[ Source](https://github.com/alexanevsky/getter-setter-accessor-bundle)[ Packagist](https://packagist.org/packages/alexanevsky/getter-setter-accessor-bundle)[ RSS](/packages/alexanevsky-getter-setter-accessor-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (6)Used By (2)

Getter &amp; Setter Accessor
============================

[](#getter--setter-accessor)

This library provides functions to read and write from/to an object and gets the list of object getters and setters.

Table of Contents
-----------------

[](#table-of-contents)

1. [First Step](#first-step)
2. [Get Value](#get-value)
3. [Set Value](#set-value)
4. [Get Getters List](#get-getters-list)
5. [Get Getters List](#get-getters-list)

First Step
----------

[](#first-step)

Add `GetterSetterAccessor` to the constructor of controller or service:

```
use Alexanevsky\GetterSetterAccessorBundle\GetterSetterAccessor;

public function __construct(
    private GetterSetterAccessor $getterSetterAccessor
) {}
```

Then let's get an accessor of some object (it can be, for example, some model):

```
$objectAccessor = $this->getterSetterAccessor->createAccessor($objectAccessor);
```

Get Value
---------

[](#get-value)

We can get the value of any property using the `getValue()` method, for example:

```
echo $objectAccessor->getValue('userName');
echo $objectAccessor->getValue('user_name');
```

The property name can be passed in both camel and snake cases. It will be converted to the one that is actually used.

If the object does not have a getter, an exception will be thrown. Before using `getValue()` we can make sure the getter exists using the `hasGetter()` method:

```
if ($objectAccessor->hasGetter('userName')) {
    echo $objectAccessor->getValue('userName');
}
```

Set Value
---------

[](#set-value)

We can set the value of any property using the `setValue()` method, for example:

```
echo $objectAccessor->SetValue('userName', 'John Doe');
echo $objectAccessor->SetValue('user_name', 'John Doe');
```

The property name can be passed in both camel and snake cases. It will be converted to the one that is actually used.

If the object does not have a setter, an exception will be thrown. Before using `setValue()` we can make sure the setter exists using the `hasSetter()` method:

```
if ($objectAccessor->hasSetter('userName')) {
    echo $objectAccessor->setValue('userName', 'John Doe');
}
```

Get Getters List
----------------

[](#get-getters-list)

We can get a list of all available object getters using the `getGetters()` method. As a result, we will get an array of `ObjectGetter[]`, each of which has the following methods:

- `getValue()` - returns a value
- `getName()` - returns the property name
- `isNullable()` - checks if the value allows null
- `getTypes()` - returns a list of types that a value can be
- `getAttribute(attributeClass)` - returns an attribute instance by the its class name
- `getAttribute(attributeClass)` - checks if an attribute exists by its class name

Get Getters List
----------------

[](#get-getters-list-1)

We can get a list of all available object getters using the `getGetters()` method. As a result, we will get an array of `ObjectGetter[]`, each of which has the following methods:

- `getValue()` - returns a value
- `getName()` - returns the property name
- `isNullable()` - checks if the value allows null
- `getTypes()` - returns a list of types that a value can be
- `getAttribute(attributeClass)` - returns an attribute instance by the its class name
- `getAttribute(attributeClass)` - checks if an attribute exists by its class name

Good luck!

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance47

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~186 days

Total

5

Last Release

396d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ed729cb5e814cf76d84dc99e64482b8628deac527a75ffd216eff74378c76413?d=identicon)[alexanevsky](/maintainers/alexanevsky)

---

Top Contributors

[![alexanevsky](https://avatars.githubusercontent.com/u/6419256?v=4)](https://github.com/alexanevsky "alexanevsky (1 commits)")

### Embed Badge

![Health badge](/badges/alexanevsky-getter-setter-accessor-bundle/health.svg)

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

###  Alternatives

[netgen/layouts-core

Netgen Layouts enables you to build and manage complex web pages in a simpler way and with less coding. This is the core of Netgen Layouts, its heart and soul.

3689.4k10](/packages/netgen-layouts-core)[symfony/ai-bundle

Integration bundle for Symfony AI components

30282.3k6](/packages/symfony-ai-bundle)[spomky-labs/pwa-bundle

Progressive Web App Manifest Generator Bundle for Symfony.

6144.4k1](/packages/spomky-labs-pwa-bundle)[symfony/ux-cropperjs

Cropper.js integration for Symfony

19280.3k3](/packages/symfony-ux-cropperjs)[netgen/content-browser

Netgen Content Browser is a Symfony bundle that provides an interface which selects items from any kind of backend and returns the IDs of selected items back to the calling code.

14112.1k8](/packages/netgen-content-browser)[pentiminax/ux-datatables

DataTables.net integration for Symfony

605.6k](/packages/pentiminax-ux-datatables)

PHPackages © 2026

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