PHPackages                             laragear/fingerprint - 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. laragear/fingerprint

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

laragear/fingerprint
====================

Ridiculously fast non-cryptographic hashes in your application or Eloquent Models

v3.0.0(3mo ago)26171MITPHPPHP ^8.3CI passing

Since Jul 22Pushed 3mo agoCompare

[ Source](https://github.com/Laragear/Fingerprint)[ Packagist](https://packagist.org/packages/laragear/fingerprint)[ Fund](https://github.com/sponsors/DarkGhostHunter)[ Fund](https://paypal.me/darkghosthunter)[ RSS](/packages/laragear-fingerprint/feed)WikiDiscussions 3.x Synced today

READMEChangelog (3)Dependencies (3)Versions (6)Used By (0)

Fingerprint
===========

[](#fingerprint)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a89c1c01fe7a0f855d4b8c1ccc4f54789b37c8f58bbfa48600e19452f116f242/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c617261676561722f66696e6765727072696e742e737667)](https://packagist.org/packages/laragear/fingerprint)[![Latest stable test run](https://github.com/Laragear/Fingerprint/actions/workflows/php.yml/badge.svg)](https://github.com/Laragear/Fingerprint/actions/workflows/php.yml)[![Codecov coverage](https://camo.githubusercontent.com/ec5cff5ffac5dd1c807e4825e8828f4b59909053fba110ed246793cbf3a1de87/68747470733a2f2f636f6465636f762e696f2f67682f4c617261676561722f46696e6765727072696e742f67726170682f62616467652e7376673f746f6b656e3d6c4f7975384634454863)](https://codecov.io/gh/Laragear/Fingerprint)[![Maintainability](https://camo.githubusercontent.com/c691a1803a659f583f86b44d798b89011f19e090eb94488bce89446bb5ff3190/68747470733a2f2f716c74792e73682f67682f4c617261676561722f70726f6a656374732f46696e6765727072696e742f6d61696e7461696e6162696c6974792e737667)](https://qlty.sh/gh/Laragear/projects/Fingerprint)[![Sonarcloud Status](https://camo.githubusercontent.com/85bbddec971c19efa0e57be9a1a7d122a50a536f019e3d4391fe91aa10717313/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d4c617261676561725f46696e6765727072696e74266d65747269633d616c6572745f737461747573)](https://sonarcloud.io/dashboard?id=Laragear_Fingerprint)[![Laravel Octane Compatibility](https://camo.githubusercontent.com/70359a356da237cd29561bc5d0bb80baae775b5ff62f288ed324755382858342/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2532304f6374616e652d436f6d70617469626c652d737563636573733f7374796c653d666c6174266c6f676f3d6c61726176656c)](https://laravel.com/docs/12.x/octane#introduction)

Ridiculously fast non-cryptographic hashes in your application or Eloquent Models.

```
use Laragear\Fingerprint\Fingerprinter;

$fingerprint = Fingerprinter::of('some-string-or-object');

return $fingerprint->hash();
```

Become a sponsor
----------------

[](#become-a-sponsor)

[![](.github/assets/support.png)](https://github.com/sponsors/DarkGhostHunter)

Your support allows me to keep this package free, up-to-date and maintainable.

Requirements
------------

[](#requirements)

- PHP 8.3 or later
- Laravel 12 or later

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

[](#installation)

You can install the package via Composer.

```
composer require laragear/fingerprint
```

How does this work?
-------------------

[](#how-does-this-work)

This adds the `Fingerprint` service in your service container to conveniently create non-cryptographic fingerprint hashes of strings, `Stringable` instance, resources, or any object in a memory-efficient way.

It leverages the power of [`hash_init()`](https://www.php.net/manual/function.hash-init.php) and `json_encode` to hash anything, including Eloquent Models or Collections, and uses the fastest hash algorithm around, [`xxHash`](https://xxhash.com/) by default.

Usage
-----

[](#usage)

To create fingerprints, you may use the `Fingerprint` facade, and any of its methods to create a hash.

```
use Laragear\Fingerprint\Facades\Fingerprint;

// Make a Base64 encoded hash
Fingerprint::make($hashable);
Fingerprint::base64($hashable);

// Make a Base64 URL-safe hash to transmit over the network.
Fingerprint::base64Url($hashable);

// Make a "raw" binary hash.
Fingerprint::binary($hashable);

// Make a hexadecimal hash.
Fingerprint::hex($hashable);

// Compare two hashes.
Fingerprint::is($expected, $string);
Fingerprint::isNot($expected, $string);
```

### Algorithms

[](#algorithms)

By default, Fingerprints are hashed using the [`xxh3` algorithm](https://xxhash.com/), [available since PHP 8.1](https://www.php.net/manual/migration81.new-features.php#migration81.new-features.hash.xxhash), which is the fastest non-cryptographic algorithm around and returns short hashes.

You may change it using the second parameter when creating fingerprints, and custom options as third parameter to be passed to `hash()|hash_init()`.

```
use Laragear\Fingerprint\Facades\Fingerprint;

$hash = Fingerprint::base64($value, 'xxh128', [
    'seed' => 33
]);
```

Note

The algorithms available will depend on your environment. You may check them using `hash_algos()`.

#### Changing the default algorithm

[](#changing-the-default-algorithm)

You may change the default format using the `Laragear\Fingerprint\Fingerprinter::$algorithm` with the one you want to be passed down to `hash()|hash_init()` methods. You may do this while your application boots in your `App\Providers\AppServiceProvider` or `bootstrap\app.php`.

```
use Illuminate\Foundation\Application;
use Laragear\Fingerprint\Fingerprinter;

return Application::configure(basePath: dirname(__DIR__))
    ->booted(function () {
        Fingerprinter::$algorithm = 'sha256';
    })
    ->create();
```

Eloquent Models
---------------

[](#eloquent-models)

You can use the [`Laragear\Fingerprint\HasFingerprints`](src/HasFingerprints.php) trait in your models to automatically calculate fingerprints in your model when saving them into the database.

Set the trait and use the `updateFingerprints()` method to return an array of all the fingerprints to calculate before persistence.

```
use Illuminate\Database\Eloquent\Model;
use Laragear\Fingerprint\HasFingerprints;
use Laragear\Fingerprint\Fingerprinter;

/**
 * @property string $body
 */
class Article extends Model
{
    use HasFingerprints;

    /**
     * Receive a Fingerprinter instance and returns an array of attributes with the fingerprints.
     *
     * @return array
     */
    public function updateFingerprints(Fingerprinter $fingerprinter): array
    {
        return [
            'fingerprint' => $fingerprinter->make($this->body)
        ];
    }
}
```

Since you receive a Fingerprinter instance, you can create a fingerprint anyway you want.

```
use Laragear\Fingerprint\Fingerprinter;

public function updateFingerprints(Fingerprinter $fingerprinter): array
{
    return [
        'fingerprint' => $fingerprinter->base64Url($this->body)
    ];
}
```

If you want to programmatically disable (or enable) the fingerprint update, use the `shouldUpdateFingerprints()` method.

```
/**
 * Checks if the model should update its fingerprints before persisting into storage.
 */
public function shouldUpdateFingerprints(): bool
{
    return $this->isPublished();
}
```

Laravel Octane compatibility
----------------------------

[](#laravel-octane-compatibility)

- There are no singletons using a stale app instance.
- There are no singletons using a stale config instance.
- There are no singletons using a stale request instance.
- There are no static properties written during a request.

There should be no problems using this package with Laravel Octane.

Security
--------

[](#security)

If you discover any security-related issues, issue a [Security Advisor](https://github.com/Laragear/Fingerprint/security/advisories/new)

License
=======

[](#license)

This specific package version is licensed under the terms of the [MIT License](LICENSE.md), at the time of publishing.

[Laravel](https://laravel.com) is a Trademark of [Taylor Otwell](https://github.com/TaylorOtwell/). Copyright © 2011–2026 Laravel LLC.

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance82

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~50 days

Recently: every ~62 days

Total

6

Last Release

95d ago

Major Versions

1.x-dev → 2.x-dev2026-03-08

v2.0.0 → 3.x-dev2026-03-30

PHP version history (2 changes)v1.0.0PHP ^8.2

2.x-devPHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5141911?v=4)[Italo](/maintainers/DarkGhostHunter)[@DarkGhostHunter](https://github.com/DarkGhostHunter)

---

Top Contributors

[![DarkGhostHunter](https://avatars.githubusercontent.com/u/5141911?v=4)](https://github.com/DarkGhostHunter "DarkGhostHunter (14 commits)")

### Embed Badge

![Health badge](/badges/laragear-fingerprint/health.svg)

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

PHPackages © 2026

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