PHPackages                             data-values/data-values - 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. data-values/data-values

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

data-values/data-values
=======================

Defines the DataValue interface and some trivial implementations

3.1.1(3mo ago)171.0M↑42.7%820GPL-2.0-or-laterPHPPHP &gt;=7.2.0CI passing

Since Nov 16Pushed 3mo ago13 watchersCompare

[ Source](https://github.com/DataValues/DataValues)[ Packagist](https://packagist.org/packages/data-values/data-values)[ Docs](https://github.com/DataValues/DataValues)[ GitHub Sponsors](https://github.com/JeroenDeDauw)[ RSS](/packages/data-values-data-values/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (15)Used By (20)

DataValues
==========

[](#datavalues)

Small PHP library that provides interfaces for Value Objects. [Several libraries](https://packagist.org/packages/data-values/data-values/dependents?order_by=downloads) build on top of this foundation.

[![GitHub Workflow Status](https://camo.githubusercontent.com/a25d8cbe236b97798a7dc35adee6662ecf8cfb80da81000ee6c3f79b55512f33/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f4461746156616c7565732f4461746156616c7565732f7068702e796d6c3f6272616e63683d6d6173746572)](https://github.com/DataValues/DataValues/actions?query=workflow%3Aphp)[![codecov](https://camo.githubusercontent.com/bb28cf3f8e52109c158259615e4b7846cb4a915a7e08e4660612c76d209e4091/68747470733a2f2f636f6465636f762e696f2f67682f4461746156616c7565732f4461746156616c7565732f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d476e4f4733464631365a)](https://codecov.io/gh/DataValues/DataValues)

On [Packagist](https://packagist.org/packages/data-values/geo): [![Latest Stable Version](https://camo.githubusercontent.com/44eb77d9b411b44ac3e3f4f41eb14d42eaf4c03302dc284815be1f82f6e8f38c/68747470733a2f2f706f7365722e707567782e6f72672f646174612d76616c7565732f646174612d76616c7565732f762f737461626c65)](https://packagist.org/packages/data-values/data-values)[![Download count](https://camo.githubusercontent.com/c8aa7924922fdfd35fc31be2938ded3cecbc61f2e2246de594497f3b911bd287/68747470733a2f2f706f7365722e707567782e6f72672f646174612d76616c7565732f646174612d76616c7565732f646f776e6c6f616473)](https://packagist.org/packages/data-values/data-values)

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

[](#installation)

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"
        }
    }
```

Running the tests
-----------------

[](#running-the-tests)

For tests only

```
composer test

```

For style checks only

```
composer cs

```

For a full CI run

```
composer ci

```

Authors
-------

[](#authors)

DataValues has been written primarily by [Jeroen De Dauw](https://www.entropywins.wtf), in part for the [Wikidata project](https://wikidata.org/) and [Wikimedia Germany](https://wikimedia.de).

Contributions where also made by [several other awesome people](https://www.openhub.net/p/datavalues/contributors).

Release notes
-------------

[](#release-notes)

### 3.1.1 (2026-06-04)

[](#311-2026-06-04)

- Added `tests/` directory to git export-ignore

### 3.1.0 (2022-10-21)

[](#310-2022-10-21)

- 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.

### 3.0.0 (2021-01-19)

[](#300-2021-01-19)

- 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

### 2.3.0 (2019-09-16)

[](#230-2019-09-16)

- `composer.json` and `phpunit.xml.dist` are now included in releases

### 2.2.1 (2019-09-05)

[](#221-2019-09-05)

- Fixed `DataValueTest` not being part of the release

### 2.2.0 (2019-09-05)

[](#220-2019-09-05)

- Deprecated `DATAVALUES_VERSION` constant

### 2.1.1 (2017-09-28)

[](#211-2017-09-28)

- Fixed `DataValueTest` not being installable via Composer

### 2.1.0 (2017-08-09)

[](#210-2017-08-09)

- Removed MediaWiki integration

### 2.0.0 (2017-08-02)

[](#200-2017-08-02)

- 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

### 1.1.1 (2017-11-02)

[](#111-2017-11-02)

- Add .gitattributes file

### 1.1.0 (2017-08-09)

[](#110-2017-08-09)

- Remove MediaWiki integration

### 1.0.0 (2014-09-26)

[](#100-2014-09-26)

- 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

### 0.1.1 (2013-11-22)

[](#011-2013-11-22)

- 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.

### 0.1.0 (2013-11-16)

[](#010-2013-11-16)

Initial release with these features:

- DataValue interface
    - BooleanValue implementation
    - NumberValue implementation
    - StringValue implementation
    - UnDeserializableValue implementation
    - UnknownValue implementation
- Common interface definitions: Comparable, Copyable, Hashable, Immutable

Links
-----

[](#links)

- [DataValues on Packagist](https://packagist.org/packages/data-values/data-values)
- [DataValues on Ohloh](https://www.ohloh.net/p/datavalues)

###  Health Score

61

—

FairBetter than 99% of packages

Maintenance80

Actively maintained with recent releases

Popularity49

Moderate usage in the ecosystem

Community40

Growing community involvement

Maturity66

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~585 days

Total

14

Last Release

103d ago

Major Versions

0.1.1 → 1.0.02014-09-26

1.0.0 → 2.0.02017-08-02

1.1.0 → 2.1.12017-09-28

1.1.1 → 2.2.02019-09-05

2.3.0 → 3.0.02021-01-19

PHP version history (3 changes)0.1PHP &gt;=5.3.0

2.0.0PHP &gt;=5.5.9

3.0.0PHP &gt;=7.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/451bd4039d530fed8f9c3da91bfa519233a397d2182cdfdcad700f6cfea19b7f?d=identicon)[Jeroen De Dauw](/maintainers/Jeroen%20De%20Dauw)

![](https://avatars.githubusercontent.com/u/22235?v=4)[Stefan Wasilewski](/maintainers/SMW)[@smw](https://github.com/smw)

![](https://www.gravatar.com/avatar/0c1ddc1309ce2f268d42afc35c3065421f8a6d21e4ca25eb338db3a297cdef1b?d=identicon)[DataValues](/maintainers/DataValues)

---

Top Contributors

[![JeroenDeDauw](https://avatars.githubusercontent.com/u/146040?v=4)](https://github.com/JeroenDeDauw "JeroenDeDauw (207 commits)")[![DanweDE](https://avatars.githubusercontent.com/u/101926?v=4)](https://github.com/DanweDE "DanweDE (74 commits)")[![translatewiki](https://avatars.githubusercontent.com/u/24829418?v=4)](https://github.com/translatewiki "translatewiki (53 commits)")[![thiemowmde](https://avatars.githubusercontent.com/u/6576639?v=4)](https://github.com/thiemowmde "thiemowmde (33 commits)")[![mariushoch](https://avatars.githubusercontent.com/u/2446964?v=4)](https://github.com/mariushoch "mariushoch (14 commits)")[![addshore](https://avatars.githubusercontent.com/u/3308769?v=4)](https://github.com/addshore "addshore (12 commits)")[![tobijat](https://avatars.githubusercontent.com/u/2997252?v=4)](https://github.com/tobijat "tobijat (9 commits)")[![Nikerabbit](https://avatars.githubusercontent.com/u/1109395?v=4)](https://github.com/Nikerabbit "Nikerabbit (7 commits)")[![Ladsgroup](https://avatars.githubusercontent.com/u/5351225?v=4)](https://github.com/Ladsgroup "Ladsgroup (7 commits)")[![AlaaSarhan](https://avatars.githubusercontent.com/u/1851753?v=4)](https://github.com/AlaaSarhan "AlaaSarhan (6 commits)")[![lucaswerkmeister](https://avatars.githubusercontent.com/u/2346599?v=4)](https://github.com/lucaswerkmeister "lucaswerkmeister (6 commits)")[![reedy](https://avatars.githubusercontent.com/u/67615?v=4)](https://github.com/reedy "reedy (5 commits)")[![manicki](https://avatars.githubusercontent.com/u/3524114?v=4)](https://github.com/manicki "manicki (3 commits)")[![itamargiv](https://avatars.githubusercontent.com/u/6132917?v=4)](https://github.com/itamargiv "itamargiv (3 commits)")[![johl](https://avatars.githubusercontent.com/u/35403?v=4)](https://github.com/johl "johl (3 commits)")[![siebrand](https://avatars.githubusercontent.com/u/210297?v=4)](https://github.com/siebrand "siebrand (3 commits)")[![legoktm](https://avatars.githubusercontent.com/u/81392?v=4)](https://github.com/legoktm "legoktm (2 commits)")[![rosalieper](https://avatars.githubusercontent.com/u/15235452?v=4)](https://github.com/rosalieper "rosalieper (1 commits)")[![tstarling](https://avatars.githubusercontent.com/u/389141?v=4)](https://github.com/tstarling "tstarling (1 commits)")[![jaakristioja](https://avatars.githubusercontent.com/u/2684083?v=4)](https://github.com/jaakristioja "jaakristioja (1 commits)")

---

Tags

wikidatawikibasedatavalues

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/data-values-data-values/health.svg)

```
[![Health](https://phpackages.com/badges/data-values-data-values/health.svg)](https://phpackages.com/packages/data-values-data-values)
```

###  Alternatives

[data-values/geo

Geographical value objects, parsers and formatters

20631.0k18](/packages/data-values-geo)[data-values/number

Numerical value objects, parsers and formatters

18303.0k14](/packages/data-values-number)[data-values/time

Time value objects, parsers and formatters

10318.6k14](/packages/data-values-time)[wikibase/data-model

PHP implementation of the Wikibase DataModel

37243.3k23](/packages/wikibase-data-model)[data-values/common

Contains common implementations of the interfaces defined by DataValuesInterfaces

11934.5k13](/packages/data-values-common)[jeroen/json-dump-reader

Provides line-by-line readers and iterators for Wikibase/Wikidata JSON dumps

7412.3k](/packages/jeroen-json-dump-reader)

PHPackages © 2026

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