PHPackages                             bjarneo/settergetter - 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. bjarneo/settergetter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

bjarneo/settergetter
====================

Micro PHP library for automatically create setter and getters to hold data

19PHP

Since Jan 25Pushed 11y ago1 watchersCompare

[ Source](https://github.com/bjarneo/SetterGetter)[ Packagist](https://packagist.org/packages/bjarneo/settergetter)[ RSS](/packages/bjarneo-settergetter/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

SetterGetter
============

[](#settergetter)

Auto generate setter and getters as you wish.

SetterGetter class is simply built with the magic method \_\_call that automatically creates methods. This is also called PHP Overloading. More information about overloading:

Installation
------------

[](#installation)

### Old school

[](#old-school)

require `src/SetterGetter.php` in your project.

### Composer

[](#composer)

Add this to your composer.json

```
{
    "require": {
        "bjarneo/settergetter": "dev-master"
    }
}
```

Usage
-----

[](#usage)

```
use SetterGetter/SetterGetter;

$sg = new SetterGetter;

// How to add methods + arguments as an array
$sg->set(array(
    'languages' => array(
        'php' => 'is fun',
        'javascript' => 'is also'
    ),
    'justAname' => 'test',
    'LARGE' => 'testest',
    'name_with_underscore' => 'Value'
));

var_dump($sg->getJustAname());
var_dump($sg->getLanguages());
var_dump($sg->getLARGE());
// If you use underscore they will be removed and words will be capitalized
var_dump($sg->getNameWithUnderscore());

$sg->setTest('Mama-san');
printf("%s \r\n", $sg->getTest());
// Output: Mama-san

// Set new value to "Test"
$sg->setTest('Old lady');
printf("%s \r\n", $sg->getTest());
// Output: Old lady

// You can add whatever you want to the setter
$sg->setTester(array(
    0 => 'test',
    1 => 'test2',
    2 => 'test3'
));

foreach($sg->getTester() as $key => $val) {
    printf("Key: %s :: Value: %s \r\n", $key, $val);
}
// Output:
// Key: 0 :: Value: test
// Key: 1 :: Value: test2
// Key: 2 :: Value: test3
```

Debugging
---------

[](#debugging)

```
// If you need to see what getters that are available, use debug method.
$sg->debug();
```

License
-------

[](#license)

SetterGetter is licensed under the MIT License

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

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

---

Top Contributors

[![bjarneo](https://avatars.githubusercontent.com/u/1419214?v=4)](https://github.com/bjarneo "bjarneo (16 commits)")

### Embed Badge

![Health badge](/badges/bjarneo-settergetter/health.svg)

```
[![Health](https://phpackages.com/badges/bjarneo-settergetter/health.svg)](https://phpackages.com/packages/bjarneo-settergetter)
```

PHPackages © 2026

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