PHPackages                             carlsson/immutable-record - 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. carlsson/immutable-record

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

carlsson/immutable-record
=========================

0.0.1(8y ago)110MITPHP

Since Apr 19Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Carlsson87/immutable-record)[ Packagist](https://packagist.org/packages/carlsson/immutable-record)[ RSS](/packages/carlsson-immutable-record/feed)WikiDiscussions master Synced 1mo ago

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

Immutable Record
================

[](#immutable-record)

A base class to create immutable records from.

Usage
=====

[](#usage)

```
use Carlsson\ImmutableRecord;

// Extend the base class to create a record.
class Point extends ImmutableRecord {

    // Provide a definiton of the record.
    // These values will be used as defaults if any are missing during construction.
    protected $defaults = [
        "x" => 0,
        "y" => 0
    ];

    // Provide some kind of constructor.
    public function __construct(float $x, float $y)
    {
        return parent::__construct([
            "x" => $x,
            "y" => $y
        ]);
    }

    // Implement any methods you want.
    public function equals(Point $other)
    {
        return $this->x === $other->x && $this->y === $other->y;
    }
}

// And off you go.
$origo = new Point(0, 0);
echo $origo->x; // 0
echo $origo->y; // 0

// If you try to mutate an immutable record, you'll regret it.
$origo->x = 1; // throws Exception
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

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

Unknown

Total

1

Last Release

2941d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/33170a414df053453702c79637d38af72a93533435f4eb9ba3d6d9af7661707c?d=identicon)[Carlsson87](/maintainers/Carlsson87)

---

Top Contributors

[![Carlsson87](https://avatars.githubusercontent.com/u/5379989?v=4)](https://github.com/Carlsson87 "Carlsson87 (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/carlsson-immutable-record/health.svg)

```
[![Health](https://phpackages.com/badges/carlsson-immutable-record/health.svg)](https://phpackages.com/packages/carlsson-immutable-record)
```

PHPackages © 2026

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