PHPackages                             emileperron/universal-identifier - 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. emileperron/universal-identifier

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

emileperron/universal-identifier
================================

Provides an universal\_identifier function, which generates a unique sha256 identifier for a provided object or array.

v1.0(5y ago)09MITPHPPHP &gt;=7.0.0

Since Jan 22Pushed 5y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

PHP universal identifiers
=========================

[](#php-universal-identifiers)

Generate unique identifiers for your PHP primitives, arrays and objects
-----------------------------------------------------------------------

[](#generate-unique-identifiers-for-your-php-primitives-arrays-and-objects)

This tiny composer package provides a `universal_identifier()` global function, which can be used to generate sha256 identifiers for values and arrays/objects.

These identifiers can be used to easily compare configurations both in code and in database queries, without having to manually sort and compare every items and sub-items inside an array or an object.

Getting started
---------------

[](#getting-started)

To get started, simply require the package via Composer:

```
composer require emileperron/universal-identifier

```

Once that's done, you can start using the `universal_identifier` function in your project. Here's a very brief overview of the library's usage and functionalities:

**Usage with primitives:**

```
