2017 © Pedro PelĂĄez
 

library immutable

Library to create PHP immutable object

image

teknoo/immutable

Library to create PHP immutable object

  • Sunday, November 12, 2017
  • by frenchcomp
  • Repository
  • 1 Watchers
  • 2 Stars
  • 6,320 Installations
  • PHP
  • 8 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 13 % Grown

The README.md

Teknoo Software - Immutable library

Latest Stable Version Latest Unstable Version Total Downloads License PHPStan, (*1)

This library helps you to create immutable object by prohibiting __set and __unset calls and several call to constructor, (*2)

Quick Example

<?php

declare(strict_types=1);

include 'vendor/autoload.php';

$a = new class implements Teknoo\Immutable\ImmutableInterface {
    use Teknoo\Immutable\ImmutableTrait;

    private array $values = ['foo' => 123];

    public function __get(string $name)
    {
        return $this->values[$name];
    }
};

//Print 123
print $a->foo;
//Throws an Teknoo\Immutable\Exception\ImmutableException
$a->foo = 'bar';
//Throws an Teknoo\Immutable\Exception\ImmutableException;
unset($a->foo);
//Throws an Teknoo\Immutable\Exception\ImmutableException;
$a->__construct(); 

Support this project

This project is free and will remain free. It is fully supported by the activities of the EIRL. If you like it and help me maintain it and evolve it, don't hesitate to support me on Patreon or Github., (*3)

Thanks :) Richard., (*4)

Credits

EIRL Richard DĂ©loge - https://deloge.io - Lead developer. SASU Teknoo Software - https://teknoo.software, (*5)

About Teknoo Software

Teknoo Software is a PHP software editor, founded by Richard DĂ©loge, as part of EIRL Richard DĂ©loge. Teknoo Software's goals : Provide to our partners and to the community a set of high quality services or software, sharing knowledge and skills., (*6)

License

Immutable is licensed under the MIT License - see the licenses folder for details., (*7)

Installation & Requirements

To install this library with composer, run this command :, (*8)

composer require teknoo/immutable

This library requires :, (*9)

* PHP 8.1+

News from Teknoo Immutable 3.0

This library requires PHP 8.1 or newer. Some changes cause bc breaks :, (*10)

  • Switch to readonly property to detect reconstructed object

News from Teknoo Immutable 2.0

This library requires PHP 7.4 or newer. Some changes cause bc breaks :, (*11)

  • PHP 7.4 is the minimum required
  • Most methods have been updated to include type hints where applicable. Please check your extension points to make sure the function signatures are correct.
  • Switch to typed properties _ All files use strict typing. Please make sure to not rely on type coercion.
  • Remove some PHP useless DockBlocks
  • Enable PHPStan in QA Tools and disable PHPMd

Contribute :)

You are welcome to contribute to this project. Fork it on Github, (*12)

The Versions

12/11 2017

dev-master

9999999-dev http://teknoo.software/immutable

Library to create PHP immutable object

  Sources   Download

MIT

The Requires

  • php ~7.0

 

The Development Requires

by Richard DĂ©loge

object immutable

12/11 2017

1.0.0

1.0.0.0 http://teknoo.software/immutable

Library to create PHP immutable object

  Sources   Download

MIT

The Requires

  • php ~7.0

 

The Development Requires

by Richard DĂ©loge

object immutable

01/08 2017

0.0.3

0.0.3.0 http://teknoo.software/immutable

Library to create PHP immutable object

  Sources   Download

MIT

The Requires

  • php ~7.0

 

The Development Requires

by Richard DĂ©loge

object immutable

15/02 2017

0.0.2

0.0.2.0 http://teknoo.software/immutable

Library to create PHP immutable object

  Sources   Download

MIT

The Requires

  • php ~7.0

 

The Development Requires

by Richard DĂ©loge

object immutable

26/07 2016

0.0.1

0.0.1.0 http://teknoo.software/immutable

Library to create PHP immutable object

  Sources   Download

MIT

The Requires

  • php ~7.0

 

The Development Requires

by Richard DĂ©loge

object immutable

09/04 2016

0.0.1-beta1

0.0.1.0-beta1 http://teknoo.software/immutable

Library to create PHP immutable object

  Sources   Download

MIT

The Requires

  • php ~7.0

 

The Development Requires

by Richard DĂ©loge

object immutable

25/02 2016

0.0.1-alpha1

0.0.1.0-alpha1 http://teknoo.software/immutable

Library to create PHP immutable object

  Sources   Download

MIT

The Requires

  • php ~7.0

 

The Development Requires

by Richard DĂ©loge

object immutable