PHPackages                             magentron/ciphersweet-for-laravel - 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. magentron/ciphersweet-for-laravel

ActiveLibrary[Security](/categories/security)

magentron/ciphersweet-for-laravel
=================================

CipherSweet for Laravel (forked from bjornvoesten/ciphersweet-for-laravel)

4.0.0(8mo ago)14.4k↓16.7%MITPHPPHP ^7.2.5|^8.0

Since Apr 17Pushed 8mo agoCompare

[ Source](https://github.com/Magentron/ciphersweet-for-laravel)[ Packagist](https://packagist.org/packages/magentron/ciphersweet-for-laravel)[ RSS](/packages/magentron-ciphersweet-for-laravel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (6)Used By (0)

(forked from: [bjornvoesten/ciphersweet-for-laravel](https://github.com/bjornvoesten/ciphersweet-for-laravel))

CipherSweet for Laravel
=======================

[](#ciphersweet-for-laravel)

A Laravel implementation of [Paragon Initiative Enterprises CipherSweet](https://ciphersweet.paragonie.com) searchable field level encryption.

Make sure you have some basic understanding of CipherSweet before continuing.

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

[](#installation)

Install the package using composer:

```
composer require bjorn-voesten/ciphersweet-for-laravel

```

The package will then automatically register itself.

#### Encryption key

[](#encryption-key)

In your `.env` file you should add:

```
CIPHERSWEET_KEY=
```

And then generate an encryption key:

```
php artisan ciphersweet:key

```

#### Config file

[](#config-file)

Publish the config file:

```
php artisan vendor:publish --tag=ciphersweet-config

```

Usage
-----

[](#usage)

### Define encryption

[](#define-encryption)

Add the `BjornVoesten\CipherSweet\Concerns\WithAttributeEncryption` trait to your model
and add the `BjornVoesten\CipherSweet\Casts\Encrypted` cast to the attributes you want to encrypt.

```
