PHPackages                             sschlein/obscure - 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. sschlein/obscure

ActiveLibrary[Security](/categories/security)

sschlein/obscure
================

Obscure IDs in requests and URLs of you Laravel 5 app

0.1.0(10y ago)8291MITPHPPHP &gt;=5.4.0

Since Feb 11Pushed 10y ago2 watchersCompare

[ Source](https://github.com/sschlein/obscure)[ Packagist](https://packagist.org/packages/sschlein/obscure)[ Docs](http://github.com/sschlein/obscure)[ RSS](/packages/sschlein-obscure/feed)WikiDiscussions master Synced 4w ago

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

Obscure
=======

[](#obscure)

Hide IDs from URLs and forms
----------------------------

[](#hide-ids-from-urls-and-forms)

[![Software License](https://camo.githubusercontent.com/f251623e510f5909f16ae3f4e6e548dac11340b9fde1a99be26b015b39272c00/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c6174)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/465ec46a853c17e6c73758780df4ba0d0c7339766853430b1c4b1c85e1dc2db0/68747470733a2f2f7472617669732d63692e6f72672f737363686c65696e2f6f6273637572652e737667)](https://travis-ci.org/sschlein/obscure)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/0635964f615fd3b2a0d6ec98226e7197f7f42764c919ed1782423376c07e9ed1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f737363686c65696e2f6f6273637572652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d617374657226)](https://scrutinizer-ci.com/g/sschlein/obscure/?branch=master)[![codecov.io](https://camo.githubusercontent.com/384e0e1b32e92db9167da4288ec4cbc880a4f1d0c644d24b7a699bfc19c52bf9/68747470733a2f2f636f6465636f762e696f2f6769746875622f737363686c65696e2f6f6273637572652f636f7665726167652e7376673f6272616e63683d6d6173746572)](https://codecov.io/github/sschlein/obscure?branch=master)[![StyleCI](https://camo.githubusercontent.com/0aa84c2b70371f1d3b4e94a4146dac37a6a1be4e3dba3ed8cb767b205e56c80c/68747470733a2f2f7374796c6563692e696f2f7265706f732f34353933393833362f736869656c643f7374796c653d666c6174)](https://styleci.io/repos/45939836)

Obscure your Laravel 5 applications IDs from URLs and requests. It's based on the popuplar [Hashids package](https://github.com/ivanakimov/hashids.php)

```
// http://exampleapplication.com/user/ALnLzW

Route::get('/user/{id}', function ($id) {
    return "ID: " . $id; //returns a number
})->middleware('obscure');
```

Contents
--------

[](#contents)

- [Installation](#installation)
- [Usage](#usage)
- [Optional Configuration](#configuration)
- [License](#license)

\## Installation In order to add obscure to your project, just add

```
"sschlein/obscure": "dev-develop"

```

to your composer.json. Then run `composer install` or `composer update`.

Or run `composer require sschlein/obscure ` if you prefer that.

### Add the service provider to your app

[](#add-the-service-provider-to-your-app)

In your `config\app.php` file, add the obscure service provider to `providers` array.

```
    // ...
    Sschlein\Obscure\ObscureServiceProvider::class,
    // ...
```

Set a salt hash in your `.env` file to generate unique hashs.

```
OBSCURE_SALT=your-unique-phrase

```

### Add the middleware to your Kernel

[](#add-the-middleware-to-your-kernel)

In your `app\Http\Kernel.php` file, add the obscure middleware to the `$routeMiddleware` array.

```
protected $routeMiddleware = [
    // ...
    'obscure'         => \Sschlein\Obscure\Middleware\Obscure::class,
    // ...
];
```

\## Usage By default, Obscure looks for routes or request parameters with a parameter named `id`. To modify this parameter, add it as a middleware parameter like this:

```
Route::get('/obscure/{user_id}', function ($user_id) {
    return "ID: " . $id; // returns a number
})->middleware('obscure:user_id');
```

If this parameter is present, it gets decoded to the id and can be used without applications changes.

```
// http://exampleapplication.com/obscure/ALnLzW
// hashed with salt "salt"

Route::get('/obscure/{id}', function ($id) {
    return "ID: " . $id; // returns a number
})->middleware('obscure');
```

To generate routes or request parameters, you can use the blade extension. In a blade template, just use

```
View User

```

If you need to obscure the id within a controller, use the facade

```
public function store(...)
{
	return redirect('users/' . Obscure::encode(1234));
}
```

That's it.

\## Optional Configuration Obscure uses some defaults that can be configured. To change the default configuration, publish the config.

```
php artisan vendor:publish
```

You can now configure the `salt` hash, the `length` of the hash and the used `alphabet` of the hash in the `config/obscure.php`.

\## License Obscure is free software distributed under the terms of the MIT license.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% 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

Unknown

Total

1

Last Release

3792d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2911113?v=4)[Sebastian Schlein](/maintainers/sschlein)[@sschlein](https://github.com/sschlein)

---

Top Contributors

[![mpociot](https://avatars.githubusercontent.com/u/804684?v=4)](https://github.com/mpociot "mpociot (3 commits)")[![sschlein](https://avatars.githubusercontent.com/u/2911113?v=4)](https://github.com/sschlein "sschlein (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sschlein-obscure/health.svg)

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

###  Alternatives

[elfsundae/laravel-hashid

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

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

The Illuminate Encryption package.

9230.4M311](/packages/illuminate-encryption)

PHPackages © 2026

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