PHPackages                             guidsen/fake-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. [Security](/categories/security)
4. /
5. guidsen/fake-identifier

ActiveLibrary[Security](/categories/security)

guidsen/fake-identifier
=======================

A package to protect your ID with some hashing.

v1.0.1(11y ago)8152PHPPHP &gt;=5.5.9

Since Jun 23Pushed 11y ago1 watchersCompare

[ Source](https://github.com/guidsen/fake-identifier)[ Packagist](https://packagist.org/packages/guidsen/fake-identifier)[ RSS](/packages/guidsen-fake-identifier/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (3)Used By (0)

With this little package you are able to transform your internal id's to obfuscated integers easily in Laravel and Lumen 5.1. The package is made on top of [jenssegers/optimus](https://github.com/jenssegers/optimus) and is similar to Hashids.
If you use this library and use the traits that comes with it, you will be able to get a hashed identifier by using the `hashed_id` attribute. So `$model->hashed_id` will contain you hashed id.
If you want to change the attribute name, you can have a look at the [usage](#usage) section.

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

[](#installation)

```
composer require guidsen/fake-identifier

```

Setup
-----

[](#setup)

The hashing algorithm depends on 3 integers.

- A large prime number lower than `2147483647`
- The inverse prime so that `(PRIME * INVERSE) & MAXID == 1`
- A large random integer lower than `2147483647`

You can calculate a prime number yourself, or pick one from this [list](http://primes.utm.edu/lists/small/millions/).
Once you have selected a prime number, you can use the included console command to calculated the inverse prime that is used for the decoding process and generate a random integer:

```
> php vendor/bin/optimus spark YOUR_PRIME

Prime: 1580030173
Inverse: 59260789
Random: 1163945558

```

Because the helpers depend on the container binding you will have to bind the instance to the container with the `optimus` key. This will look like (fill in your the values you just generated):

```
$this->app->bind('optimus', function () {
    $optimus = new \Guidsen\FakeIdentifier\Optimus(15468539, 1296427827, 340274557);
    return $optimus;
});

```

Usage
-----

[](#usage)

The library comes with two helper traits.
**FakeIdentifier**: This trait should be used in your model. This will add a attribute containing the hashed id.
**FakeIdentifierHelper**: This trait should be used in your controllers or base controller. It will contain a `encode` and `decode` method which could be usefull.

The attribute which will contain the hashed id, default to `hashed_id`. You can change this to your own favorite id by using the `setAttributeName` method on the Optimus instance in the container binding.

```
$optimus = new \Guidsen\FakeIdentifier\Optimus(15468539, 1296427827, 340274557);
$optimus->setAttributeName('my_hashed_id');

```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Total

2

Last Release

4022d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5262871?v=4)[Guido Schmitz](/maintainers/guidsen)[@guidsen](https://github.com/guidsen)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/guidsen-fake-identifier/health.svg)

```
[![Health](https://phpackages.com/badges/guidsen-fake-identifier/health.svg)](https://phpackages.com/packages/guidsen-fake-identifier)
```

###  Alternatives

[elfsundae/laravel-hashid

A simple, elegant way to obfuscate your data by generating reversible, non-sequential, URL-safe identifiers.

416260.7k2](/packages/elfsundae-laravel-hashid)[illuminate/encryption

The Illuminate Encryption package.

9630.7M326](/packages/illuminate-encryption)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)

PHPackages © 2026

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