PHPackages                             takeoto/attributable - 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. takeoto/attributable

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

takeoto/attributable
====================

Abstraction for objects with custom attributes.

0.1(3y ago)054MITPHPPHP &gt;=7.4

Since May 4Pushed 2y ago1 watchersCompare

[ Source](https://github.com/takeoto/attributable)[ Packagist](https://packagist.org/packages/takeoto/attributable)[ RSS](/packages/takeoto-attributable/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

attributable
============

[](#attributable)

### Abstraction for objects with custom attributes

[](#abstraction-for-objects-with-custom-attributes)

#### Usage

[](#usage)

```
use Takeoto\Attributable\Contract\ReadableAttributesInterface;
use Takeoto\Attributable\Contract\WritableAttributesInterface;
use Takeoto\Attributable\TraitReadableAttributes;
use Takeoto\Attributable\TraitWriteableAttributes;

# --- Readable attributes

class SomeClassReadable implements ReadableAttributesInterface
{
    use TraitReadableAttributes;

    /**
     * @param mixed[] $attributes
     */
    public function __construct(private array $attributes = [])
    {
    }

    # some class logic ...
}

$object = new SomeClassReadable([
    'someAttribute' => 'someValue',
    'someAttribute1' => 'someValue1',
]);

if ($object->hasAttr('someAttribute')) { # true
    echo $object->getAttr('someAttribute'); # "someValue"
}

$object->getAttrs(); # [ 'someAttribute' => 'someValue', 'someAttribute1' => 'someValue1' ]
$object->getAttr('undefinedAttribute'); # throws an exception

# --- Writable attributes

class SomeClassWritable implements WritableAttributesInterface
{
    use TraitWriteableAttributes;
    # some class logic ...
}

$object = new SomeClassWritable();
$object->setAttr('someAttribute', 'someValue');
$object->unsetAttr('someAttribute');
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

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

1108d ago

### Community

Maintainers

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

---

Tags

phpabstractiondtotakeotoattributable

### Embed Badge

![Health badge](/badges/takeoto-attributable/health.svg)

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

###  Alternatives

[ebidtech/collection

A set of interfaces and traits to speed up the creation of collections

13119.8k6](/packages/ebidtech-collection)

PHPackages © 2026

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