PHPackages                             consistence/consistence - 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. consistence/consistence

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

consistence/consistence
=======================

Consistence - consistent approach and additions to PHP's functionality

2.0.2(4y ago)1831.1M↑25.8%15[6 PRs](https://github.com/consistence/consistence/pulls)18MITPHPPHP ~7.2CI passing

Since Jan 11Pushed 1y ago6 watchersCompare

[ Source](https://github.com/consistence/consistence)[ Packagist](https://packagist.org/packages/consistence/consistence)[ RSS](/packages/consistence-consistence/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (17)Used By (18)

Consistence
===========

[](#consistence)

PHP offers a lot of handy functionality, but due to its organic growth this is not always easily usable. The aim of this library is to provide consistent approach to PHP's functionality. This means:

- clear and consistent naming patterns
- consistent arguments order
- errors reported as Exceptions, never as return values
- added functionality and interfaces, which are missing
- value objects representing common elements

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

[](#installation)

Install package [`consistence/consistence`](https://packagist.org/packages/consistence/consistence) with [Composer](https://getcomposer.org/):

```
composer require consistence/consistence
```

There are no further steps needed, you can start using Consistence whenever suitable in your codebase, see features below.

### Integrations

[](#integrations)

If you are using one of the following libraries/frameworks, check out these integrations:

- [Doctrine ORM integration](https://github.com/consistence/consistence-doctrine) provides integration to store Consistence value objects in database through entities, there is also [Symfony bundle with this integration](https://github.com/consistence/consistence-doctrine-symfony)
- [JMS Serializer integration](https://github.com/consistence/consistence-jms-serializer) provides integration to (de)serialize Consistence value objects, there is also [Symfony bundle with this integration](https://github.com/consistence/consistence-jms-serializer-symfony)

Documentation &amp; features
----------------------------

[](#documentation--features)

In following sections, there are excerpts of Consistence functionality helping in key areas along with links to dedicated documentation pages.

### [Enums and MultiEnums](docs/Enum/enums.md)

[](#enums-and-multienums)

Enums represent predefined set of values. The available values are defined statically by each enum class. Each value is represented by an instance of this class in a flyweight manner. This ensures that the same values are always the same instance.

```
