PHPackages                             skyraptor/laravel-encryptable-trait - 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. skyraptor/laravel-encryptable-trait

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

skyraptor/laravel-encryptable-trait
===================================

Laravel encryptable trait, easily make certain fields for eloquent models encryptable

1.5.1(3y ago)0507MITPHPPHP ^7.2|^8.0

Since Sep 12Pushed 3y agoCompare

[ Source](https://github.com/bumbummen99/laravel-encryptable-trait)[ Packagist](https://packagist.org/packages/skyraptor/laravel-encryptable-trait)[ Docs](https://github.com/hihaho/laravel-encryptable-trait)[ RSS](/packages/skyraptor-laravel-encryptable-trait/feed)WikiDiscussions master Synced 1mo ago

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

Laravel Encryptable Trait
=========================

[](#laravel-encryptable-trait)

[![CI](https://github.com/bumbummen99/laravel-encryptable-trait/actions/workflows/run-tests.yml/badge.svg)](https://github.com/bumbummen99/laravel-encryptable-trait/actions/workflows/run-tests.yml)[![StyleCI](https://camo.githubusercontent.com/2373b28385a524e96acb1f2f553ae0143eafd9f7e3f6f03c785c689f00d77a73/68747470733a2f2f7374796c6563692e696f2f7265706f732f3130333234363339382f736869656c643f6272616e63683d6d6173746572267374796c653d666c6174)](https://styleci.io/repos/103246398)[![Code Climate](https://camo.githubusercontent.com/5c694ad8d13f4124116324eaa52b388d5133cb5ca96755c2a6b695fcc5b86d22/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f48694861486f2d496e7465726163746976652d566964656f2f6c61726176656c2d656e637279707461626c652d74726169742f6261646765732f6770612e737667)](https://codeclimate.com/github/HiHaHo-Interactive-Video/laravel-encryptable-trait)[![Latest Stable Version](https://camo.githubusercontent.com/816c8573e42fe1c245e8a2776d7364024903f78b4ef70866ab8c2973580a2d80/68747470733a2f2f706f7365722e707567782e6f72672f68696861686f2f6c61726176656c2d656e637279707461626c652d74726169742f762f737461626c65)](https://packagist.org/packages/hihaho/laravel-encryptable-trait)[![Total Downloads](https://camo.githubusercontent.com/857289636444726f655e51eb6ee574f8291951bed3d188659bd24e5b35d1c8f0/68747470733a2f2f706f7365722e707567782e6f72672f68696861686f2f6c61726176656c2d656e637279707461626c652d74726169742f646f776e6c6f616473)](https://packagist.org/packages/hihaho/laravel-encryptable-trait)[![Latest Unstable Version](https://camo.githubusercontent.com/36019a6330050141b7cdfb984ddd6427ed0204e7ab8fdbbeffa5aa1d119c8928/68747470733a2f2f706f7365722e707567782e6f72672f68696861686f2f6c61726176656c2d656e637279707461626c652d74726169742f762f756e737461626c65)](https://packagist.org/packages/hihaho/laravel-encryptable-trait)[![License](https://camo.githubusercontent.com/a250b1de6211e3e1944db4eb8c5f6954370f28239dcbe35805959dfdaa06f170/68747470733a2f2f706f7365722e707567782e6f72672f68696861686f2f6c61726176656c2d656e637279707461626c652d74726169742f6c6963656e7365)](https://packagist.org/packages/hihaho/laravel-encryptable-trait)[![Dependency Status](https://camo.githubusercontent.com/7195ed410359964482f39ae074f01427819bb654b0d3e31d55eaedd5f1f9d7d0/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3539623763373135306662323466303033326534306434652f62616467652e7376673f7374796c653d666c6174)](https://www.versioneye.com/user/projects/59b7c7150fb24f0032e40d4e)

This trait encrypts all your fields (defined in $this-&gt;encryptable) before saving it to the database. It makes it extremely easy to treat certain fields as encryptable by automatically encrypting and decrypting the values.

Photoware
=========

[](#photoware)

This package is free to use, but inspired by [Spaties' Poscardware](https://spatie.be/en/opensource/postcards) we'd love to see where where this package is being developed. A photo of an important landmark in your area would be highly appreciated.

Our email address is

Install
=======

[](#install)

Simply add the following line to your `composer.json` and run `composer update`

```
"skyraptor/laravel-encryptable-trait": "^v1.5"

```

Or use composer to add it with the following command

```
composer require skyraptor/laravel-encryptable-trait
```

Requirements
------------

[](#requirements)

- illuminate/encryption ^6.0, ^7.0, ^8.0 or ^9.0
- PHP 7.2, 7.3, 7.4, 8.0 or 8.1

Usage
=====

[](#usage)

Simply add the trait to your models and set the `$encryptable` to an array of values that need to be encrypted.

```
