PHPackages                             waseem/laravel-data-encryption - 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. waseem/laravel-data-encryption

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

waseem/laravel-data-encryption
==============================

Automatically encryption and decryption data overriding by using getAttribute an setAttribute methods of Eloquent Model.

1.0.1(2y ago)063↓100%MITPHPPHP ^7.3|^8.0

Since Jun 25Pushed 2y ago2 watchersCompare

[ Source](https://github.com/waseemahmad10/laravel-data-encryption)[ Packagist](https://packagist.org/packages/waseem/laravel-data-encryption)[ RSS](/packages/waseem-laravel-data-encryption/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (5)Versions (4)Used By (0)

laravel-data-encryption
=======================

[](#laravel-data-encryption)

A trait to encrypt data models in Laravel, this automatically encrypt and decrypt model data overriding getAttribute an setAttribute methods of Eloquent Model.

How to install
--------------

[](#how-to-install)

Run composer installation

```
    composer require waseem/laravel-data-encryption
```

Add ServiceProvider to your app/config.php file

```
    'providers' => [
        ...
        \Waseem\Encipher\EncipherServiceProvider::class,
    ],
```

Publish configuration file, this will create config/encrypt.php

```
     php artisan vendor:publish --provider=Waseem\Encipher\EncipherServiceProvider
```

How to use
----------

[](#how-to-use)

1. You must add `SECRET_ENCRYPT_KEY` and `ENCRYPT_PREFIX` in your .env file or set it in your `config/encrypt.php` file
2. Use the `Waseem\Encipher\Encipher` trait:

    ```
    use Waseem\Encipher\Encipher;
    ```
3. Set the `$encipher` array on your Model.

    ```
    protected $encipher = ['encrypted_property'];
    ```
4. Here's a complete example:

    ```
