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

ActiveLibrary[Security](/categories/security)

caseraph/ciphersweet-for-laravel
================================

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

v1.0.0(1mo ago)0266MITPHPPHP ^7.2.5|^8.0|^8.1|^8.2|^8.3

Since Jun 11Pushed 1mo agoCompare

[ Source](https://github.com/ca-seraph/ciphersweet-for-laravel)[ Packagist](https://packagist.org/packages/caseraph/ciphersweet-for-laravel)[ RSS](/packages/caseraph-ciphersweet-for-laravel/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

(forked from: [magentron/ciphersweet-for-laravel](https://github.com/Magentron/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 caseraph/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.

```
