PHPackages                             jeyroik/i-have-attributes - 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. jeyroik/i-have-attributes

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

jeyroik/i-have-attributes
=========================

Simple attributes implementation

1.0.1(9mo ago)05975PHPCI passing

Since May 23Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/jeyroik/i-have-attributes)[ Packagist](https://packagist.org/packages/jeyroik/i-have-attributes)[ RSS](/packages/jeyroik-i-have-attributes/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (2)Versions (7)Used By (5)

i-have-attributes
=================

[](#i-have-attributes)

Simple attributes implementation.

[![tests](https://github.com/jeyroik/i-have-attributes/workflows/PHP%20Composer/badge.svg?branch=master&event=push)](https://github.com/jeyroik/i-have-attributes/workflows/PHP%20Composer/badge.svg?branch=master&event=push)[![codecov.io](https://camo.githubusercontent.com/c070acce555126f17d01a0e67dd34cdaebcf1d0d2b799b3ef9b76c92eab911fb/68747470733a2f2f636f6465636f762e696f2f67682f6a6579726f696b2f692d686176652d617474726962757465732f636f7665726167652e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/c070acce555126f17d01a0e67dd34cdaebcf1d0d2b799b3ef9b76c92eab911fb/68747470733a2f2f636f6465636f762e696f2f67682f6a6579726f696b2f692d686176652d617474726962757465732f636f7665726167652e7376673f6272616e63683d6d6173746572)[![PHPStan Enabled](https://camo.githubusercontent.com/441b5874ce4df0a2defc892979c96c46889b69cb32119d04f0b48626349f8bc9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d656e61626c65642d627269676874677265656e2e7376673f7374796c653d666c6174)](https://github.com/phpstan/phpstan)[![](https://camo.githubusercontent.com/8040fa69eb4acb16e863b88797147d2c864fdd6c801f7d481544ef4b33c60c14/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f33663030386639373066376439353263313533322f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/jeyroik/i-have-attributes/maintainability)[![Latest Stable Version](https://camo.githubusercontent.com/447500cab0dff93a3e1a7f572d95ccda7a53800bc187b8d8afc0d6236e2f2fe8/68747470733a2f2f706f7365722e707567782e6f72672f6a6579726f696b2f692d686176652d617474726962757465732f76)](//packagist.org/packages/jeyroik/i-have-attributes)[![Total Downloads](https://camo.githubusercontent.com/4474fe93667121a11e2c9acb55b473b6a38c7534597f5ecd54441740cb1d8261/68747470733a2f2f706f7365722e707567782e6f72672f6a6579726f696b2f692d686176652d617474726962757465732f646f776e6c6f616473)](//packagist.org/packages/jeyroik/i-have-attributes)[![Dependents](https://camo.githubusercontent.com/e84b84d0bc498d8599d592369cb40a335b5fe35f5805e7375eeddccfbf6e04e0/68747470733a2f2f706f7365722e707567782e6f72672f6a6579726f696b2f692d686176652d617474726962757465732f646570656e64656e7473)](//packagist.org/packages/jeyroik/i-have-attributes)

Usage
=====

[](#usage)

See tests for details.

`$ composer test`

```
$something = new class ([
    'p1' => 'v1',
    'p2' => 'v2'
]) implements IHaveAttributes {
    use THasAttributes;
};

$this->assertEquals('v1', $something->getAttribute('p1'));
$this->assertEquals('v1', $something->getAttributeString('p1'));
$this->assertEquals('v1', $something['p1']);

$this->assertEquals('{"p1":"v1","p2":"v2"}', json_encode($something));

foreach($something as $name => $value) {
    if ($name == 'p2') {
        $this->assertEquals('v2', $value);
    }
}

$this->assertTrue(isset($something['p1']));
unset($something['p1']);
$this->assertFalse(isset($something['p1']));;

$something->__merge(['p2' => 'v2.1', 'p3' => 'v3']);

$this->assertEquals(
    ['p2' => 'v2.1', 'p3' => 'v3'],
    $something->__toArray()
);
```

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance55

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity53

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 ~240 days

Recently: every ~221 days

Total

6

Last Release

298d ago

Major Versions

0.2.0 → 1.0.02025-09-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/2aaec5c4bade6ab2b5d1a0f7d97ab4e0ff2ce83937f76499b2888ad16cde5e04?d=identicon)[jeyroik](/maintainers/jeyroik)

---

Top Contributors

[![jeyroik](https://avatars.githubusercontent.com/u/6348124?v=4)](https://github.com/jeyroik "jeyroik (14 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jeyroik-i-have-attributes/health.svg)

```
[![Health](https://phpackages.com/badges/jeyroik-i-have-attributes/health.svg)](https://phpackages.com/packages/jeyroik-i-have-attributes)
```

PHPackages © 2026

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