Small PHP library that provides interfaces for Value Objects. Several libraries build on top of this foundation.

On Packagist:

To add this package as a local, per-project dependency to your project, simply add a
dependency on data-values/data-values to your project's composer.json file.
Here is a minimal example of a composer.json file that just defines a dependency on
DataValues 3.x:
{
"require": {
"data-values/data-values": "^3.1.0"
}
}
For tests only
For style checks only
For a full CI run
DataValues has been written primarily by Jeroen De Dauw,
in part for the Wikidata project and Wikimedia Germany.
Contributions where also made by
several other awesome people.
- Improved compatibility with PHP 8.1;
in particular, the new __serialize/__unserialize methods are implemented now
(in addition to the still supported Serializable interface).
Care has been taken to keep the output of getHash() stable;
if other classes include the PHP serialization of data values in their own hashes,
they should instead use the new getSerializationForHash() method where it exists.
- Removed getCopy from the DataValue interface and all implementations
- Removed getSortKey from the DataValue interface and all implementations
- Removed the Comparable, Hashable and Immutable interfaces
- Removed DATAVALUES_VERSION constant
- Removed DataValueTest (create a copy if you need it, though better refactor away the bad design)
- Raised minimum PHP version from 5.5.9 to 7.2
- composer.json and phpunit.xml.dist are now included in releases
- Fixed DataValueTest not being part of the release
- Deprecated DATAVALUES_VERSION constant
- Fixed DataValueTest not being installable via Composer
- Removed MediaWiki integration
- Dropped Copyable interface
- Dropped deprecated constant DataValues_VERSION, use DATAVALUES_VERSION instead
- Deprecated newFromArray in all DataValue implementations.
- Updated minimal required PHP version from 5.3 to 5.5.9
- Updated documentation throughout the code
- Remove MediaWiki integration
- The CI now ensures compatibility with PHP 5.6 and HHVM
- A lot of type hints where improved
- Protected methods and fields where changed to private
- The test bootstrap no longer executes composer update
- The test bootstrap now sets PHP strict mode
- The contract of the Hashable::getHash method was updated
- The MediaWiki internationalization support has been migrated to the JSON based version
- Removed support for running the tests via the MediaWiki test runner.
- The test bootstrapping file now automatically does a composer install.
- Removed custom autoloader in favour of defining autoloading in composer.json.
Initial release with these features:
- DataValue interface
- BooleanValue implementation
- NumberValue implementation
- StringValue implementation
- UnDeserializableValue implementation
- UnknownValue implementation
- Common interface definitions: Comparable, Copyable, Hashable, Immutable