PHPackages                             imhayatunnabi/laravel-hashes - 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. imhayatunnabi/laravel-hashes

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

imhayatunnabi/laravel-hashes
============================

A Laravel package for automatic encryption and decryption of model attributes

00PHP

Since Apr 14Pushed 1y ago1 watchersCompare

[ Source](https://github.com/imhayatunnabi/laravel-model-encryption-decryption)[ Packagist](https://packagist.org/packages/imhayatunnabi/laravel-hashes)[ RSS](/packages/imhayatunnabi-laravel-hashes/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Hashes
==============

[](#laravel-hashes)

A Laravel package for automatic encryption and decryption of model attributes.

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

[](#installation)

You can install the package via composer:

```
composer require imhayatunnabi/laravel-hashes
```

The package will automatically register its service provider.

Usage
-----

[](#usage)

1. Add the `HasEncryptedAttributes` trait to your model:

```
use Imhayatunnabi\LaravelHashes\Traits\HasEncryptedAttributes;

class User extends Model
{
    use HasEncryptedAttributes;

    /**
     * The attributes that should be encrypted.
     *
     * @var array
     */
    protected $encryptable = [
        'email',
        'phone',
        // Add other attributes you want to encrypt
    ];
}
```

2. That's it! Now your model attributes will be automatically encrypted when saving to the database and decrypted when retrieving from the database.

Example
-------

[](#example)

```
// Creating a new user
$user = User::create([
    'name' => 'John Doe',
    'email' => 'john@example.com',
    'phone' => '1234567890'
]);

// The email and phone will be automatically encrypted in the database

// Retrieving the user
$user = User::find(1);
echo $user->email; // Will automatically decrypt and show 'john@example.com'
echo $user->phone; // Will automatically decrypt and show '1234567890'
```

Security
--------

[](#security)

The package uses Laravel's built-in encryption facilities, which means:

1. It uses the `APP_KEY` from your `.env` file for encryption
2. It uses AES-256-CBC encryption by default
3. All encrypted values are signed with a message authentication code (MAC) to detect any modifications

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/329c63ef83165c1dfe77071f53ab92287bdb201a7fe83ab1a06a426bd2a9bcdd?d=identicon)[imhayatunnabi](/maintainers/imhayatunnabi)

---

Top Contributors

[![imhayatunnabi](https://avatars.githubusercontent.com/u/44812376?v=4)](https://github.com/imhayatunnabi "imhayatunnabi (2 commits)")

### Embed Badge

![Health badge](/badges/imhayatunnabi-laravel-hashes/health.svg)

```
[![Health](https://phpackages.com/badges/imhayatunnabi-laravel-hashes/health.svg)](https://phpackages.com/packages/imhayatunnabi-laravel-hashes)
```

###  Alternatives

[francescomalatesta/laravel-amplitude

A Laravel package to work with Amplitude.

125.3k](/packages/francescomalatesta-laravel-amplitude)

PHPackages © 2026

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