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(10y ago)8152PHPPHP &gt;=5.5.9

Since Jun 23Pushed 10y 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 1mo ago

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 59% 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

3976d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2bf25987210635909386d972e2193d3af36719e2eb7327be682a42087c393a42?d=identicon)[guidsen](/maintainers/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

[illuminate/encryption

The Illuminate Encryption package.

9229.7M280](/packages/illuminate-encryption)[tzsk/otp

A secure, database-free One-Time Password (OTP) generator and verifier for PHP and Laravel.

241641.4k1](/packages/tzsk-otp)[genealabs/laravel-governor

Managing policy and control in Laravel.

201262.8k](/packages/genealabs-laravel-governor)[dgtlss/warden

A Laravel package that proactively monitors your dependencies for security vulnerabilities by running automated composer audits and sending notifications via webhooks and email

8745.6k](/packages/dgtlss-warden)[ercsctt/laravel-file-encryption

Secure file encryption and decryption for Laravel applications

642.6k](/packages/ercsctt-laravel-file-encryption)[laragear/poke

Keep your forms alive, avoid TokenMismatchException by gently poking your Laravel app

2211.5k](/packages/laragear-poke)

PHPackages © 2026

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