f500 / equatable
Equatable objects and collections in PHP
Installs: 8 826
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires (Dev)
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ^2.5
This package is not auto-updated.
Last update: 2022-09-03 07:23:41 UTC
README
Equatable objects and collections in PHP.
We reach a limitation in PHP when we want to compare objects in such a way that ==
yields incorrect results.
We often overcome this limitation by implementing a method like equals($other)
encapsulating our specialized behaviour.
This library provides an interface for this.
We hit secondary problems when we try to work with these objects, especially when dealing with arrays of them.
Functions like in_array()
and array_search()
don't use our specialized equals()
method, so they in turn yield incorrect results.
To overcome these problems, this library provides a map (ordered dictionary-style collection) and a vector (stack-like collection).
These are immutable and final, meant to replace normal arrays.
Authored by Jasper N. Brouwer.
Under the collective flag of Future500 B.V.
Installation
composer.phar require f500/equatable