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

ActiveLibrary

anexia/laravel-encryption
=========================

Encryption and decryption for eloquent models

1.0.0(7y ago)24.1k1MITPHP

Since Oct 10Pushed 7y ago1 watchersCompare

[ Source](https://github.com/anexia-it/anexia-laravel-encryption)[ Packagist](https://packagist.org/packages/anexia/laravel-encryption)[ RSS](/packages/anexia-laravel-encryption/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (1)DependenciesVersions (2)Used By (1)

Laravel Database Encryption
===========================

[](#laravel-database-encryption)

A Laravel package that adds database encryption support to eloquent models.

1. Installation and configuration
---------------------------------

[](#1-installation-and-configuration)

### 1. Install via composer

[](#1-install-via-composer)

Install the module via composer, therefore adapt the require part of your composer.json:

```
"require": {
    "anexia/laravel-encryption": "1.0.0"
}

```

Now run

```
composer update [-o]

```

to add the packages source code to your /vendor directory and update the autoloading.

### 2. Add service provider to app config

[](#2-add-service-provider-to-app-config)

```
'providers' => [
    /*
     * Package Service Providers...
     */
    \Anexia\LaravelEncryption\DatabaseEncryptionServiceProvider::class,
]

```

### 3. Add cipher to database config

[](#3-add-cipher-to-database-config)

Currently only Postgres and PGP is supported.

```
'pgsql' => [
    'driver' => 'pgsql',
    'host' => env('DB_HOST', '127.0.0.1'),
    'port' => env('DB_PORT', '5432'),
    'database' => env('DB_DATABASE', 'forge'),
    'username' => env('DB_USERNAME', 'forge'),
    'password' => env('DB_PASSWORD', ''),
    'charset' => 'utf8',
    'prefix' => '',
    'schema' => 'public',
    'sslmode' => 'prefer',
    'cipher' => 'pgp'
],

```

2. Usage
========

[](#2-usage)

2.1 Models
----------

[](#21-models)

Add the DatabaseEncryption Trait to your eloquent model.

```
