PHPackages                             florianwolters/component-core-immutable - 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. florianwolters/component-core-immutable

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

florianwolters/component-core-immutable
=======================================

The Immutable Object implementation pattern as a PHP component.

v0.2.0(12y ago)106552LGPL-3.0+PHPPHP &gt;=5.4

Since Mar 19Pushed 12y ago1 watchersCompare

[ Source](https://github.com/FlorianWolters/PHP-Component-Core-Immutable)[ Packagist](https://packagist.org/packages/florianwolters/component-core-immutable)[ Docs](http://github.com/FlorianWolters/PHP-Component-Core-Immutable)[ RSS](/packages/florianwolters-component-core-immutable/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (10)Versions (3)Used By (2)

Component\\Core\\Immutable
==========================

[](#componentcoreimmutable)

**FlorianWolters\\Component\\Core\\Immutable** is a simple-to-use [PHP](https://php.net "PHP: Hypertext Preprocessor") component that implements the **Immutable Object** implementation pattern.

[![Build Status](https://camo.githubusercontent.com/0a573d2b76e358080dd4fe1cf2b28cb2828e4a677c9d191c4b3865ca7a25a7c0/68747470733a2f2f7472617669732d63692e6f72672f466c6f7269616e576f6c746572732f5048502d436f6d706f6e656e742d436f72652d496d6d757461626c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/FlorianWolters/PHP-Component-Core-Immutable)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/20774f6bcd5f4896e48b7efa3beb69d2c507e076e7329b33d66571e24255cbc9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f466c6f7269616e576f6c746572732f5048502d436f6d706f6e656e742d436f72652d496d6d757461626c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/FlorianWolters/PHP-Component-Core-Immutable/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/6656cad4ae399ea748669120a78222c0d98dba6a4fda695556cde3edc53967ca/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f466c6f7269616e576f6c746572732f5048502d436f6d706f6e656e742d436f72652d496d6d757461626c652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/FlorianWolters/PHP-Component-Core-Immutable/?branch=master)[![SensioLabsInsight](https://camo.githubusercontent.com/df43fdf501da75ec0b1d67c04ff3609db7c6df9bcd11741ad6fed31f178d86c6/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f39663165656534622d666231332d343636642d613462302d3236393661393534663832622f6d696e692e706e67)](https://insight.sensiolabs.com/projects/9f1eee4b-fb13-466d-a4b0-2696a954f82b)[![Coverage Status](https://camo.githubusercontent.com/9c17fcbf396767cbefc486b5aac177ed30de3c63fb3d002fb6631af3c697deda/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f466c6f7269616e576f6c746572732f5048502d436f6d706f6e656e742d436f72652d496d6d757461626c652f62616467652e706e673f6272616e63683d6d6173746572)](https://coveralls.io/r/FlorianWolters/PHP-Component-Core-Immutable?branch=master)

[![Latest Stable Version](https://camo.githubusercontent.com/f179f1ec768b4eaab342b482352fbfe5d9901621787cb92e08101bcacce85b99/68747470733a2f2f706f7365722e707567782e6f72672f666c6f7269616e776f6c746572732f636f6d706f6e656e742d636f72652d696d6d757461626c652f762f737461626c652e706e67)](https://packagist.org/packages/florianwolters/component-core-immutable)[![Total Downloads](https://camo.githubusercontent.com/67289e1aa2034c0b1bcfd4968f95cef041429fac27f3491cc6f37d2ee4e6e039/68747470733a2f2f706f7365722e707567782e6f72672f666c6f7269616e776f6c746572732f636f6d706f6e656e742d636f72652d696d6d757461626c652f646f776e6c6f6164732e706e67)](https://packagist.org/packages/florianwolters/component-core-immutable)[![Monthly Downloads](https://camo.githubusercontent.com/d863728d2d81105608932528f1aa0ef7ae4687b0eed01d34b0d2302519a9142a/68747470733a2f2f706f7365722e707567782e6f72672f666c6f7269616e776f6c746572732f636f6d706f6e656e742d636f72652d696d6d757461626c652f642f6d6f6e74686c792e706e67)](https://packagist.org/packages/florianwolters/component-core-immutable)[![Daily Downloads](https://camo.githubusercontent.com/4fde0808c7b148abeff6ec197104fe9fb504104616dc5ebadb3c7eed4d312550/68747470733a2f2f706f7365722e707567782e6f72672f666c6f7269616e776f6c746572732f636f6d706f6e656e742d636f72652d696d6d757461626c652f642f6461696c792e706e67)](https://packagist.org/packages/florianwolters/component-core-immutable)[![Latest Unstable Version](https://camo.githubusercontent.com/1732391196645bb1c1ae6d1183329bbdd618238391845730bf5fbccc7583cf36/68747470733a2f2f706f7365722e707567782e6f72672f666c6f7269616e776f6c746572732f636f6d706f6e656e742d636f72652d696d6d757461626c652f762f756e737461626c652e706e67)](https://packagist.org/packages/florianwolters/component-core-immutable)[![License](https://camo.githubusercontent.com/adeb76a70614b5bb8c9f7e2a17e2eac01177f34e9c2215be09b87ee776b5da79/68747470733a2f2f706f7365722e707567782e6f72672f666c6f7269616e776f6c746572732f636f6d706f6e656e742d636f72652d696d6d757461626c652f6c6963656e73652e706e67)](https://packagist.org/packages/florianwolters/component-core-immutable)

[![Stories in Ready](https://camo.githubusercontent.com/c0ec18315f1e398674477af95311f761c5c9258c55c9217cbac0797820d9f266/68747470733a2f2f62616467652e776166666c652e696f2f666c6f7269616e776f6c746572732f7068702d636f6d706f6e656e742d636f72652d696d6d757461626c652e706e673f6c6162656c3d7265616479267469746c653d5265616479)](https://waffle.io/florianwolters/php-component-core-immutable)[![Dependency Status](https://camo.githubusercontent.com/c3384776bd77087a22196ccad17b3b8f65694abcb074ebdbbf894263e8bcdbaa/68747470733a2f2f76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3531633333313032303037666364303030323030303433392f62616467652e706e67)](https://versioneye.com/user/projects/51c33102007fcd0002000439)[![Dependencies Status](https://camo.githubusercontent.com/85d2d90bc7d3d4dd9ab5470e4464ab9c7d15c6d6526f88c24a9b0db935bcb8d8/68747470733a2f2f646570656e64696e672e696e2f466c6f7269616e576f6c746572732f5048502d436f6d706f6e656e742d436f72652d496d6d757461626c652e706e67)](http://depending.in/FlorianWolters/PHP-Component-Core-Immutable)[![HHVM Status](https://camo.githubusercontent.com/112be51dec49885372caf9ef361ef3a9048f116ab7b17031171130aaa98b65f8/687474703a2f2f6868766d2e683463632e64652f62616467652f666c6f7269616e776f6c746572732f636f6d706f6e656e742d636f72652d696d6d757461626c652e706e67)](http://hhvm.h4cc.de/package/florianwolters/component-core-immutable)

Table of Contents (ToC)
-----------------------

[](#table-of-contents-toc)

- [Introduction](#introduction)
- [Features](#features)
- [Requirements](#requirements)
- [Usage](#usage)
- [Installation](#installation)
- [As A Dependency On Your Component](#as-a-dependency-on-your-component)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

Introduction
------------

[](#introduction)

> An object is considered immutable if its state cannot change after it is constructed. Maximum reliance on immutable objects is widely accepted as a sound strategy for creating simple, reliable code.
>
> \[...\]
>
> Programmers are often reluctant to employ immutable objects, because they worry about the cost of creating a new object as opposed to updating an object in place. The impact of object creation is often overestimated, and can be offset by some of the efficiencies associated with immutable objects. These include decreased overhead due to garbage collection, and the elimination of code needed to protect mutable objects from corruption.

\-- [Immutable Objects (The Java Tutorials)](http://docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html "Immutable Objects (The Java Tutorials)")

Features
--------

[](#features)

- Artifacts tested with both static and dynamic test procedures:
    - Dynamic component tests (unit and integration tests) implemented with [PHPUnit](https://phpunit.de "PHPUnit").
    - Static code analysis performed using the following tools:
        - [PHP\_CodeSniffer](https://pear.php.net/package/PHP_CodeSniffer "PHP_CodeSniffer"): Style Checker
        - [PHP Mess Detector (PHPMD)](http://phpmd.org "PHPMD - PHP Mess Detector"): Code Analyzer
        - [PHP Depend](http://pdepend.org "PHP Depend - Software Metrics for PHP"): Code Metrics
        - [phpcpd](https://github.com/sebastianbergmann/phpcpd "sebastianbergmann/phpcpd · GitHub"): Copy/Paste Detector (CPD)
        - [phpdcd](https://github.com/sebastianbergmann/phpdcd "sebastianbergmann/phpdcd · GitHub"): Dead Code Detector (DCD)
        - [SensioLabs Security Checker](https://github.com/sensiolabs/security-checker "SensioLabs Security Checker"): Security Checker
    - Continuous Integration (CI) using the following web services:
        - [Scrutinizer CI](https://scrutinizer-ci.com "Scrutinizer CI")
        - [SensioLabsInsight](https://insight.sensiolabs.com "SensioLabsInsight")
        - [Coveralls](https://coveralls.io "Coveralls")
        - [VersionEye](https://versioneye.com "VersionEye")
        - [Depending](https://depending.in "Depending")
        - [Waffle](https://waffle.io "Waffle")
- Provides a [Packagist](https://packagist.org "Packagist") package which can be installed using the dependency manager [Composer](https://getcomposer.org "Composer"). Click [here](https://packagist.org/packages/florianwolters/component-core-immutable "florianwolters/component-core-immutable - Packagist") for the package on [Packagist](https://packagist.org "Packagist").
- Provides a complete Application Programming Interface (API) documentation generated with the documentation generator [phpDocumentor](http://phpdoc.org "phpDocumentor"). Click [here](http://blog.florianwolters.de/PHP-Component-Core-Immutable "Application Programming Interface (API) documentation") for the API documentation.
- Follows the following "standards" from the [PHP Framework Interoperability Group (FIG)](http://php-fig.org "PHP-FIG — PHP Framework Interop Group"). PSR stands for PHP Standards Recommendation:
    - [PSR-0](http://php-fig.org/psr/psr-0 "PSR-0 requirements for autoloader interoperability"): Autoloading Standards

        > Aims to provide a standard file, class and namespace convention to allow plug-and-play code.
    - [PSR-1](http://php-fig.org/psr/psr-1 "PSR-1 basic coding style guide"): Basic Coding Standard

        > Aims to ensure a high level of technical interoperability between shared PHP code.
    - [PSR-2](http://php-fig.org/psr/psr-2 "PSR-2 coding style guide"): Coding Style Guide

        > Provides a Coding Style Guide for projects looking to standardize their code.
    - [PSR-4](http://php-fig.org/psr/psr-4 "PSR-4: Improved Autoloading"): Autoloader

        > A more modern take on autoloading reflecting advances in the ecosystem.
- Follows the [Semantic Versioning](http://semver.org "Semantic Versioning") (SemVer) specification version 2.0.0.

Requirements
------------

[](#requirements)

### Production

[](#production)

- [PHP](https://php.net "PHP: Hypertext Preprocessor") &gt;= 5.4
- [Composer](https://getcomposer.org "Composer")
- [FlorianWolters/PHP-Component-Core-Immutable](https://github.com/FlorianWolters/PHP-Component-Core-Immutable "FlorianWolters/PHP-Component-Core-Immutable · GitHub")

### Development

[](#development)

- [PHPUnit](https://phpunit.de "PHPUnit")
- [phpcpd](https://github.com/sebastianbergmann/phpcpd "sebastianbergmann/phpcpd · GitHub")
- [phpdcd](https://github.com/sebastianbergmann/phpdcd "sebastianbergmann/phpdcd · GitHub")
- [PHP\_CodeSniffer](https://pear.php.net/package/PHP_CodeSniffer "PHP_CodeSniffer")
- [PHP Mess Detector (PHPMD)](http://phpmd.org "PHPMD - PHP Mess Detector")
- [PDepend](http://pdepend.org "PHP Depend - Software Metrics for PHP")
- [phpDocumentor](http://phpdoc.org "phpDocumentor")
- [SensioLabs Security Checker](https://github.com/sensiolabs/security-checker "SensioLabs Security Checker")
- [php-coveralls](https://github.com/satooshi/php-coveralls "satooshi/php-coveralls · GitHub")

Usage
-----

[](#usage)

The best documentation for **FlorianWolters\\Component\\Core\\Immutable** are the unit tests, which are shipped in the package.

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

[](#installation)

**FlorianWolters\\Component\\Core\\Immutable** should be installed using the dependency manager [Composer](https://getcomposer.org "Composer").

> [Composer](https://getcomposer.org "Composer") is a tool for dependency management in [PHP](https://php.net "PHP: Hypertext Preprocessor"). It allows you to declare the dependent libraries your project needs and it will install them in your project for you.

The [Composer](https://getcomposer.org "Composer") installer can be downloaded with `php`.

```
php -r "readfile('https://getcomposer.org/installer');" | php

```

> This will just check a few [PHP](https://php.net "PHP: Hypertext Preprocessor") settings and then download `composer.phar` to your working directory. This file is the [Composer](https://getcomposer.org "Composer") binary. It is a PHAR ([PHP](https://php.net "PHP: Hypertext Preprocessor") archive), which is an archive format for [PHP](https://php.net "PHP: Hypertext Preprocessor") which can be run on the command line, amongst other things.

> To resolve and download dependencies, run the `install` command:

```
php composer.phar install

```

As A Dependency On Your Component
---------------------------------

[](#as-a-dependency-on-your-component)

If you are creating a component that relies on **FlorianWolters\\Component\\Core\\Immutable**, please make sure that you add **FlorianWolters\\Component\\Core\\Immutable** to your component's `composer.json` file:

```
{
    "require": {
        "florianwolters/component-core-immutable": "0.2.*"
    }
}
```

Contributing
------------

[](#contributing)

See [`CONTRIBUTING.md`](CONTRIBUTING.md).

Credits
-------

[](#credits)

- [Florian Wolters](https://github.com/FlorianWolters "FlorianWolters · GitHub")
- [All Contributors](https://github.com/FlorianWolters/PHP-Component-Core-Immutable/contributors "Contributors to FlorianWolters/PHP-Component-Core-Immutable")

License
-------

[](#license)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see .

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity49

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

Total

2

Last Release

4419d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/75dd7e42d69a87c4a0c68b4f29f5d223eb1f9a3f647abafa72da80d2a06d2442?d=identicon)[FlorianWolters](/maintainers/FlorianWolters)

---

Top Contributors

[![FlorianWolters](https://avatars.githubusercontent.com/u/1318837?v=4)](https://github.com/FlorianWolters "FlorianWolters (28 commits)")

---

Tags

coreimmutableimmutable-objectimmutable class

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/florianwolters-component-core-immutable/health.svg)

```
[![Health](https://phpackages.com/badges/florianwolters-component-core-immutable/health.svg)](https://phpackages.com/packages/florianwolters-component-core-immutable)
```

###  Alternatives

[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k417.9M1.7k](/packages/nette-utils)[fidry/cpu-core-counter

Tiny utility to get the number of CPU cores.

242163.0M34](/packages/fidry-cpu-core-counter)[aeon-php/calendar

PHP type safe, immutable calendar library

20410.2M16](/packages/aeon-php-calendar)[typo3/cms-composer-installers

TYPO3 CMS Installers

6114.3M62](/packages/typo3-cms-composer-installers)[innmind/immutable

Immutable PHP primitive wrappers

74226.3k83](/packages/innmind-immutable)[rtlopez/decimal

An object oriented immutable arbitrary-precision arithmetic library for PHP

27270.4k2](/packages/rtlopez-decimal)

PHPackages © 2026

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