Skip to content

Repository files navigation

Immutable

PHP library to easily implement immutable objects


useSteefMin\Immutable\Immutable;
/** * @method self withId(int $id)  */finalclassDTO {
use Immutable;
publicfunction__construct(
privatereadonlyint$id,
privatereadonlystring$value,
){
}
publicfunctionid(): int
{
return$this->id;
}
} $original = newDTO(1, 'one');
$updated = $original->with('id', 2);
// or $updated = $original->withId(2);
echo$original->id(); // 1echo$updated->id(); // 2

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages