PHPackages                             rakshazi/get-set-go-improved - 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. rakshazi/get-set-go-improved

Abandoned → [rakshazi/get-set-trait](/?search=rakshazi%2Fget-set-trait)Library

rakshazi/get-set-go-improved
============================

Dynamic Setter-Getter for PHP 5.4+

019PHP

Since May 27Pushed 9y agoCompare

[ Source](https://github.com/rakshazi/GetSetGoImproved)[ Packagist](https://packagist.org/packages/rakshazi/get-set-go-improved)[ RSS](/packages/rakshazi-get-set-go-improved/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

GetSetGoImproved [![Build Status](https://camo.githubusercontent.com/a07b20583ea60cc81f256a3ee402df3ac2b912ca8f3b98cb29828e6e667de3ee/68747470733a2f2f7472617669732d63692e6f72672f75736d616e68616c616c69742f476574536574476f2e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/usmanhalalit/GetSetGo)
===============================================================================================================================================================================================================================================================================================================

[](#getsetgoimproved-)

This repo is unmaintained, use [GetSetTrait](https://github.com/rakshazi/getSetTrait) instead.
==============================================================================================

[](#this-repo-is-unmaintained-use-getsettrait-instead)

A dynamic setter-getter library for PHP 5.4+.

You can use methods like `setFoo('bar')` and `getFoo()`, which you DON'T have to create (in your class). GetSetGo will make these methods work for you automatically as long as you have a `$foo` property in your class.

It makes use of Traits, so `using` it is super simple, you don't have to extend any class, as you can extend a single class only, we don't force you to use ours. You can restrict to only getter only or you can specify a Type for property using **annotations**.

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

[](#installation)

GetSetGo uses [Composer](http://getcomposer.org/) to make hassles Go.

Learn to use composer and add this to require (in your composer.json):

```
"rakshazi/get-set-go-improved": "dev-master"

```

Library on [Packagist](https://packagist.org/packages/rakshazi/get-set-go-improved).

Usage
-----

[](#usage)

Just add this in your classes:

```
use \GetSetGo\SetterGetter;

```

Example:

```
Class MyClass{
    use \GetSetGo\SetterGetter;

    protected $foo;
}
```

Now use it as

```
$myClass = new MyClass;

$myClass->setFoo('bar');
echo $myClass->getFoo();
```

**That's basically it.**

### Restrict Getter or Setter or Both

[](#restrict-getter-or-setter-or-both)

You can use annotation in you class property if you want to disable setter, getter or both using `@setter` and `@getter` annotation variables.

```
/**
 * We can't use setSomeProperty() anymore.
 *
 * @var
 * @setter false
 */
protected $someProperty;
```

---

```
/**
 * We can't use getSomeProperty() anymore.
 *
 * @var \stdClass
 * @getter false
 */
protected $someProperty;
```

---

```
/**
 * We can't use setSomeProperty() or getSomeProperty().
 *
 * @getter false
 * @setter false
 */
protected $someProperty;
```

### Force a Type or Class

[](#force-a-type-or-class)

You can specify a type for the property using `@var` annotation variable, so setter will take only a value of this type, else it will throw an exception. The code below will work similar as `public function setSomeProperty(stdClass $value){}`

```
/**
 * Should be an instance of stdClass only.
 *
 * @var \stdClass
 */
protected $shouldBeStdClass;
```

---

```
/**
 * Should be an array only.
 *
 * @var Array
 */
protected $shouldBeArray;
```

---

```
/**
 * Should be a string only
 *
 * @var String
 */
protected $shouldBeString;
```

---

```
/**
 * Should be a number only.
 *
 * @var Number
 */
protected $shouldBeNumber;
```

---

```
/**
 * Should be an object only.
 *
 * @var Object
 */
protected $shouldBeObject;
```

Notes
-----

[](#notes)

GetSetGo assumes that you use proper camelCase. So name your properties like `$pdoInstance` (not `$PDOInstance`) and call `setPdoInstance()` method.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

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/5d07cb59ba8a7317225b73c56424f74b590ac60f6991f958f58d31ab50bb70ef?d=identicon)[rakshazi](/maintainers/rakshazi)

---

Top Contributors

[![rakshazi](https://avatars.githubusercontent.com/u/3428087?v=4)](https://github.com/rakshazi "rakshazi (5 commits)")

### Embed Badge

![Health badge](/badges/rakshazi-get-set-go-improved/health.svg)

```
[![Health](https://phpackages.com/badges/rakshazi-get-set-go-improved/health.svg)](https://phpackages.com/packages/rakshazi-get-set-go-improved)
```

PHPackages © 2026

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