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

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

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

Defines interfaces for ValueParsers, ValueFormatters and ValueValidators

1.2.0(1y ago)9945.9k↑48.1%610GPL-2.0-or-laterPHPPHP &gt;=7.4CI passing

Since Nov 16Pushed 4mo ago12 watchersCompare

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

READMEChangelog (10)Dependencies (5)Versions (15)Used By (10)

DataValues Interfaces
=====================

[](#datavalues-interfaces)

The design of this library is poor and its reason for existing is questionable. Most of the time you are likely better served by creating dedicated interfaces within your project.

DataValues Interfaces is a small PHP library that defines a set of interfaces for parsers, formatters, and validators. It is part of the [DataValues set of libraries](https://github.com/DataValues).

[![Build Status](https://camo.githubusercontent.com/c9780ff3bb3f6c3d5ee38d3f30d86f67c0cac3f4a3375bf3b8ad034653fefd58/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f4461746156616c7565732f496e74657266616365732f7068702e796d6c3f6272616e63683d6d6173746572)](https://github.com/DataValues/Interfaces/actions/workflows/php.yml?query=workflow%3APHP)[![Code Coverage](https://camo.githubusercontent.com/33bc453a060593fe7cdce98be319daf4736b2bb6ba94ce7d1f88daeb15c91281/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4461746156616c7565732f496e74657266616365732f6261646765732f636f7665726167652e706e673f733d36343332643239626633666564303638393935653636303933616435326530353330393961393136)](https://scrutinizer-ci.com/g/DataValues/Interfaces/)

On [Packagist](https://packagist.org/packages/data-values/interfaces): [![Latest Stable Version](https://camo.githubusercontent.com/c26435a7633d90dcc14399b11fd2d15187953da5598d9cb45316353f0988322f/68747470733a2f2f706f7365722e707567782e6f72672f646174612d76616c7565732f696e74657266616365732f762f737461626c65)](https://packagist.org/packages/data-values/interfaces)[![Download count](https://camo.githubusercontent.com/345ee0a5b08eafa03136076d7b0d725718380ed57ad6e96d3b80f13ab931813c/68747470733a2f2f706f7365722e707567782e6f72672f646174612d76616c7565732f696e74657266616365732f646f776e6c6f616473)](https://packagist.org/packages/data-values/interfaces)

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

[](#installation)

To use this library in your project, simply add a dependency on `data-values/interfaces`to your project's `composer.json` file. Here is a minimal example of a `composer.json`file that just defines a dependency on Interfaces 1.x:

```
{
    "require": {
        "data-values/interfaces": "^1.0"
    }
}
```

Tests
-----

[](#tests)

This library comes with a set up PHPUnit tests that cover all non-trivial code. You can run these tests using the PHPUnit configuration file found in the root directory. The tests can also be run via Github Actions.

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

[](#release-notes)

### 1.2.0 (2024-12-10)

[](#120-2024-12-10)

- Dropped support for PHP 7.2 and PHP 7.3
- Improved support for PHP 8.4 by explicitly declaring nullable types
- Upgraded codesniffer rules to current `mediawiki/mediawiki-codesniffer` version (45.0.0)
- Added testing with PHP 8.1 up to 8.4

### 1.1.0 (dev)

[](#110-dev)

- Introduced `ParserOptions::withDefaultOption()` and `FormatterOptions::withDefaultOption()`, which return a copy of the options with the default applied; the `defaultOption()` methods, which modify the options in place, are deprecated.

### 1.0.0 (2021-01-20)

[](#100-2021-01-20)

- Updated minimum required PHP version from 5.5.9 to 7.2
- Removed `ValueFormatterBase`
- Removed `ValueFormatterTestBase`
- Removed `ValueValidator::setOptions`
- Removed `ValueValidatorObject`
- Removed `DATAVALUES_INTERFACES_VERSION` constant
- `ValueValidators\Result` is now final
- The properties of `ValueValidators\Error` are now private instead of protected

### 0.2.5 (2017-08-09)

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

- Removed MediaWiki extension credits registration

### 0.2.4 (2017-08-02)

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

- Fixed `ValueFormatterTestBase` not being installable via Composer.

### 0.2.3 (2017-08-02)

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

- Updated minimal required PHP version from 5.3 to 5.5.9.
- Minor fixes to code documentation.
- Added PHPCS support.

### 0.2.2 (2016-07-15)

[](#022-2016-07-15)

- Fixed `ValueFormatterTestBase` not doing strict string comparisons.

### 0.2.1 (2016-01-13)

[](#021-2016-01-13)

- Fixed an issue when using this component with HHVM 1.11.0 (see #21).

### 0.2.0 (2015-08-11)

[](#020-2015-08-11)

- Dropped deprecated `ErrorObject`, use `Error` instead
- Dropped deprecated `ResultObject`, use `Result` instead
- Dropped deprecated constant `DataValuesInterfaces_VERSION`, use `DATAVALUES_INTERFACES_VERSION` instead
- Dropped `ValueFormatterTestBase::getFormatterClass`
- Made `ValueFormatterTestBase::getInstance` abstract
- The options in `ValueFormatterTestBase::getInstance` are now optional

### 0.1.5 (2015-02-14)

[](#015-2015-02-14)

- The options in the `ValueFormatterBase` constructor are now optional
- The MediaWiki extension registration now includes the license

### 0.1.4 (2014-04-14)

[](#014-2014-04-14)

- Added rawValue and expectedFormat arguments to `ValueParsers\ParseException`

### 0.1.3 (2014-03-31)

[](#013-2014-03-31)

- Added `ValueFormatters\FormattingException`

### 0.1.2 (2013-11-22)

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

- Improved autoloading code
- Fixed link in MediaWiki credits
- Renamed entry point from DataValuesInterfaces.php to Interfaces.php

### 0.1.0 (2013-11-16)

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

Initial release with these features:

- `ValueFormatters\ValueFormatter` interface
- `ValueParsers\ValueParser` interface
- `ValueValidators\ValueValidator` interface

Links
-----

[](#links)

- [DataValues Interfaces on Packagist](https://packagist.org/packages/data-values/interfaces)

###  Health Score

55

—

FairBetter than 98% of packages

Maintenance60

Regular maintenance activity

Popularity47

Moderate usage in the ecosystem

Community33

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 54.3% of commits — single point of failure

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

Recently: every ~671 days

Total

14

Last Release

525d ago

Major Versions

0.2.5 → 1.0.02021-01-20

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

0.2.3PHP &gt;=5.5.9

1.0.0PHP &gt;=7.2

1.2.0PHP &gt;=7.4

### Community

Maintainers

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

![](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 (100 commits)")[![thiemowmde](https://avatars.githubusercontent.com/u/6576639?v=4)](https://github.com/thiemowmde "thiemowmde (38 commits)")[![manicki](https://avatars.githubusercontent.com/u/3524114?v=4)](https://github.com/manicki "manicki (9 commits)")[![addshore](https://avatars.githubusercontent.com/u/3308769?v=4)](https://github.com/addshore "addshore (6 commits)")[![Ladsgroup](https://avatars.githubusercontent.com/u/5351225?v=4)](https://github.com/Ladsgroup "Ladsgroup (5 commits)")[![mariushoch](https://avatars.githubusercontent.com/u/2446964?v=4)](https://github.com/mariushoch "mariushoch (5 commits)")[![adrianheine](https://avatars.githubusercontent.com/u/139208?v=4)](https://github.com/adrianheine "adrianheine (4 commits)")[![reedy](https://avatars.githubusercontent.com/u/67615?v=4)](https://github.com/reedy "reedy (4 commits)")[![rosalieper](https://avatars.githubusercontent.com/u/15235452?v=4)](https://github.com/rosalieper "rosalieper (3 commits)")[![lucaswerkmeister](https://avatars.githubusercontent.com/u/2346599?v=4)](https://github.com/lucaswerkmeister "lucaswerkmeister (3 commits)")[![legoktm](https://avatars.githubusercontent.com/u/81392?v=4)](https://github.com/legoktm "legoktm (2 commits)")[![codders](https://avatars.githubusercontent.com/u/17782?v=4)](https://github.com/codders "codders (2 commits)")[![jaakristioja](https://avatars.githubusercontent.com/u/2684083?v=4)](https://github.com/jaakristioja "jaakristioja (1 commits)")[![AlaaSarhan](https://avatars.githubusercontent.com/u/1851753?v=4)](https://github.com/AlaaSarhan "AlaaSarhan (1 commits)")[![tstarling](https://avatars.githubusercontent.com/u/389141?v=4)](https://github.com/tstarling "tstarling (1 commits)")

---

Tags

wikidatadatavaluesvalueparsersvalueformattersvaluevalidators

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[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)[data-values/common

Contains common implementations of the interfaces defined by DataValuesInterfaces

11934.5k13](/packages/data-values-common)[data-values/data-values

Defines the DataValue interface and some trivial implementations

171.0M22](/packages/data-values-data-values)[data-values/geo

Geographical value objects, parsers and formatters

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

PHPackages © 2026

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