PHPackages                             phine/accessor - 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. phine/accessor

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

phine/accessor
==============

A PHP library for simplifying the use of accessors.

1.0.0(12y ago)521MITPHPPHP &gt;=5.4

Since Nov 7Pushed 12y agoCompare

[ Source](https://github.com/kherge-archive/lib-accessor)[ Packagist](https://packagist.org/packages/phine/accessor)[ Docs](https://github.com/phine/lib-accessor)[ RSS](/packages/phine-accessor/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Accessor
========

[](#accessor)

[![Build Status](https://camo.githubusercontent.com/a065bc24d665fca1b49ce0fa67eb0d291e5ae8ca2d64b2b789f802e5608aff1f/68747470733a2f2f7472617669732d63692e6f72672f7068696e652f6c69622d6163636573736f722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/phine/lib-accessor)[![Coverage Status](https://camo.githubusercontent.com/a785895110a87d799af3aaf4997d51a0cd9f6c3ad2a5584193ac419cbc0afd87/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f7068696e652f6c69622d6163636573736f722f62616467652e706e67)](https://coveralls.io/r/phine/lib-accessor)[![Latest Stable Version](https://camo.githubusercontent.com/e4e36f68375117fdde6be686ec7e8563d16e45a157ff1304ae1d57daf70c04bd/68747470733a2f2f706f7365722e707567782e6f72672f7068696e652f6163636573736f722f762f737461626c652e706e67)](https://packagist.org/packages/phine/accessor)[![Total Downloads](https://camo.githubusercontent.com/d493a2cbfb6a48989091e77a008d4fbcf1ee93475c9098c9da01c1ca69777d8b/68747470733a2f2f706f7365722e707567782e6f72672f7068696e652f6163636573736f722f646f776e6c6f6164732e706e67)](https://packagist.org/packages/phine/accessor)

A PHP library for simplifying the use of accessors.

Usage
-----

[](#usage)

```
use Doctrine\ORM\Mapping as ORM;
use Phine\Accessor\AccessorTrait;
use Phine\Accessor\Type\InstanceType;

/**
 * This is an example Doctrine entity class.
 *
 * @ORM\Entity()
 * @ORM\Table()
 */
class Address
{
    use AccessorTrait;

    /**
     * The country the address resides in.
     *
     * @var Country
     *
     * @ORM\JoinColumn(name="country")
     * @ORM\ManyToOne(targetEntity="Country")
     */
    private $country;

    /**
     * The unique identifier for this address.
     *
     * @var integer
     *
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     * @ORM\Id()
     */
    private $id;

    /**
     * The state the address resides in.
     *
     * @var State
     *
     * @ORM\JoinColumn(name="state")
     * @ORM\ManyToOne(targetEntity="State")
     */
    private $state;

    /**
     * Configures the accessors.
     */
    public function __construct()
    {
        $this->makePropertyAccessible('country');
        $this->makePropertyAccessible('id');
        $this->makePropertyAccessible('state');

        $this->makePropertyMutable('country', new InstanceType('Country'));
        $this->makePropertyMutable('state', new InstanceType('State'));
    }
}
```

Now we make use of that example class:

```
// this all works just fine
$address = new Address();
$address->country = new Country();
$address->state = new State();

// these throw exceptions
$address->country = new State();
$address->id = 123;
$address->state = null;
```

Requirement
-----------

[](#requirement)

- PHP &gt;= 5.4

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

[](#installation)

Via [Composer](http://getcomposer.org/):

```
$ composer require "phine/accessor=~1.0"

```

Documentation
-------------

[](#documentation)

You can find the documentation in the [`docs/`](docs/) directory.

License
-------

[](#license)

This library is available under the [MIT license](LICENSE).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

4571d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9122157?v=4)[Kevin Herrera](/maintainers/kherge)[@kherge](https://github.com/kherge)

---

Top Contributors

[![kherge](https://avatars.githubusercontent.com/u/9122157?v=4)](https://github.com/kherge "kherge (7 commits)")

---

Tags

gettersetteraccessors

### Embed Badge

![Health badge](/badges/phine-accessor/health.svg)

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

###  Alternatives

[usmanhalalit/get-set-go

Dynamic Setter-Getter for PHP 5.4+

1813.4k1](/packages/usmanhalalit-get-set-go)[antares/accessible

PHP library that allows you to define your class' getters, setters and constructor with docblock annotations.

123.9k1](/packages/antares-accessible)

PHPackages © 2026

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