PHPackages                             famdirksen/laravel-model-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. [Security](/categories/security)
4. /
5. famdirksen/laravel-model-encryption

ActiveLibrary[Security](/categories/security)

famdirksen/laravel-model-encryption
===================================

Laravel package to encrypt model attributes

38.3k2PHP

Since May 1Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Famdirksen/Laravel-Model-Encryption)[ Packagist](https://packagist.org/packages/famdirksen/laravel-model-encryption)[ RSS](/packages/famdirksen-laravel-model-encryption/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

Laravel Model Encryption
========================

[](#laravel-model-encryption)

[![Latest Version on Packagist](https://camo.githubusercontent.com/bf0dfcc12490a8238104d6b1b4c403f81acd5b7eb18ad37541f7ff5ecbe0bae8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66616d6469726b73656e2f4c61726176656c2d4d6f64656c2d456e6372797074696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/famdirksen/Laravel-Model-Encryption)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/19d0a370ee9da19eab376fee8a7b25f67bc07b1f33569b1b5758f46766865735/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f46616d6469726b73656e2f4c61726176656c2d4d6f64656c2d456e6372797074696f6e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/Famdirksen/Laravel-Model-Encryption)[![Coverage Status](https://camo.githubusercontent.com/99eb2f8b829b6c36cb43e64185d9525bd83337520ac1700944a666cc18c02ca0/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f66616d6469726b73656e2f4c61726176656c2d4d6f64656c2d456e6372797074696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/famdirksen/Laravel-Model-Encryption/code-structure)[![Quality Score](https://camo.githubusercontent.com/091ee1d51f0acde406ceeff228a34a8ee372ba62a63727b3a0a5a092e3b8ee96/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f66616d6469726b73656e2f4c61726176656c2d4d6f64656c2d456e6372797074696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/famdirksen/Laravel-Model-Encryption)[![Total Downloads](https://camo.githubusercontent.com/50cd3338e25311ded68715873f91a0a71ad2ca32dddacb168f0050c9248a5e3e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f66616d6469726b73656e2f4c61726176656c2d4d6f64656c2d456e6372797074696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/famdirksen/Laravel-Model-Encryption)

About
-----

[](#about)

This package can be used by simply adding a trait to the model you want to encrypt.

Install
-------

[](#install)

Via Composer

```
$ composer require famdirksen/laravel-model-encryption
```

Usage
-----

[](#usage)

To use this package in your own project, you need to add the `trait` to the model. In the following example we installed Larave 5.6 and ran `php artisan make:auth` to setup authentication.

You need to use the trait, `ModelEncryption` and add the `protected $encryptable` property to your User class, this way you'll enable model encryption on your user data.

app/User.php:

```
