PHPackages                             wwardaww/laravel-id-cryption - 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. [Database &amp; ORM](/categories/database)
4. /
5. wwardaww/laravel-id-cryption

ActiveLibrary[Database &amp; ORM](/categories/database)

wwardaww/laravel-id-cryption
============================

A trait for Laravel/Lumen Model id encryption.

v1.0.1(8y ago)037MITPHP

Since Feb 6Pushed 8y ago2 watchersCompare

[ Source](https://github.com/wwardaww/laravel-id-cryption)[ Packagist](https://packagist.org/packages/wwardaww/laravel-id-cryption)[ Docs](https://github.com/wwardaww/laravel-id-cryption)[ RSS](/packages/wwardaww-laravel-id-cryption/feed)WikiDiscussions master Synced today

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

Laravel Id Cryption
===================

[](#laravel-id-cryption)

[![Latest Stable Version](https://camo.githubusercontent.com/83b5d34a770f614b3561cb389fa9df84d7821c6775898fae8eb4a81bb508126d/68747470733a2f2f706f7365722e707567782e6f72672f77776172646177772f6c61726176656c2d69642d6372797074696f6e2f76657273696f6e)](https://packagist.org/packages/wwardaww/laravel-id-cryption)[![License](https://camo.githubusercontent.com/5f065b3bc419538e2708c18c215d7697a949f197c23716a970e6495a939ee9a1/68747470733a2f2f706f7365722e707567782e6f72672f77776172646177772f6c61726176656c2d69642d6372797074696f6e2f6c6963656e7365)](https://packagist.org/packages/wwardaww/laravel-id-cryption)

This Trait **Encrypt** Your Data *(from database or somewhere)* or, **Decrypt** Your data *(from client or somewhere)* and it doesn't effect your real data *(from data source)*.

> Based on [samwhisker/laravel-trait-encrypt](https://github.com/samWhisker/laravel-trait-encrypt)

### Installing

[](#installing)

`composer require wwardaww/laravel-id-cryption`

**Note** : APP\_KEY **must not be empty** in your `.env` file.

##### In Your Model File

[](#in-your-model-file)

- Use Trait :

```
use Wwardaww\Encryptable;

        class YourModel extends Model
        {

            use Encryptable;
```

- Add your **Encryptable** columns and **Hidden** functions :

```
 protected $encryptable = [
        'id',
        'account_id',
        'profile_id',
        'user_id',
        'some_id'
 ];

 protected $hiddenFunctions = [
        'someDefaultFunc',
        'someDefaultFunc2',
 ];
```

### Usage

[](#usage)

#### Example Table on Your Data Source

[](#example-table-on-your-data-source)

IDName5Ahmet Oğuz#### Get Object Whit Encrypted Id

[](#get-object-whit-encrypted-id)

```
$encryptedId = "eyJpdiI6IlpxVWtpMGt4dERZbkRcL3hXVTZLKzVRPT0iLCJ2YWx1ZSI6IkhUNzF3MEFsRW1cL2tcLzVTRlZ6QmVaZz09IiwibWFjIjoiZTI5M2JiZTRiNzA2NGVjMTIwNmJhNWZjNjA4YmRmY2NlNzIxYTA2MWM3YTI1ZjVlYzQyMWQ5MzIwZDBlYzQ1OSJ9"
$data = YourModel::decryptFind($encrptedId);
```

#### Get Encrypted Data

[](#get-encrypted-data)

```
$data = YourModel::where('somewhere','data')->get()->toArray();
```

- **Result Will be** :

```
Array(
    [
        "id" => "eyJpdiI6IlpxVWtpMGt4dERZbkRcL3hXVTZLKzVRPT0iLCJ2YWx1ZSI6IkhUNzF3MEFsRW1cL2tcLzVTRlZ6QmVaZz09IiwibWFjIjoiZTI5M2JiZTRiNzA2NGVjMTIwNmJhNWZjNjA4YmRmY2NlNzIxYTA2MWM3YTI1ZjVlYzQyMWQ5MzIwZDBlYzQ1OSJ9",
        "name" => "Ahmet Oğuz"
    ]
)
```

- **If You don't Convert to Array, Result Will be** :

```
 $data->id = 5,
 $data->name = "Ahmet Oğuz"
```

#### Disable Encryption Specific Function

[](#disable-encryption-specific-function)

- You Should Add Your Function to **$hiddenFunctions** in Your Model File
- When You Call Your Model in This Function , Result will be :

##### Call

[](#call)

```
public function someDefaultFunc2(Request $req){
    $data = YourModel::where('somewhere','data')->get()->toArray();
    ...
}
```

##### Result

[](#result)

```
Array(
    [
        "id" => 5,
        "name" => "Ahmet Oğuz"
    ]
)
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

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

Total

2

Last Release

3017d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a4f0870c57d3fa12b8ce0075315f69bd684bef4165dccb7eb69ae9b14e6b394e?d=identicon)[wwardaww](/maintainers/wwardaww)

---

Top Contributors

[![wwardaww](https://avatars.githubusercontent.com/u/12273655?v=4)](https://github.com/wwardaww "wwardaww (6 commits)")

---

Tags

laravelencryptionmodeleloquentencrypttrait

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wwardaww-laravel-id-cryption/health.svg)

```
[![Health](https://phpackages.com/badges/wwardaww-laravel-id-cryption/health.svg)](https://phpackages.com/packages/wwardaww-laravel-id-cryption)
```

###  Alternatives

[betterapp/laravel-db-encrypter

Provides database model attribute encryption/decryption

365614.7k8](/packages/betterapp-laravel-db-encrypter)[delatbabel/elocryptfive

Automatically encrypt and decrypt Eloquent attributes with ease.

8493.0k](/packages/delatbabel-elocryptfive)[dolphiq/laravel-aescrypt

AES encrypt and decrypt Eloquent attributes inspired by elocryptfive

171.7k](/packages/dolphiq-laravel-aescrypt)

PHPackages © 2026

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