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

ActiveLibrary[Security](/categories/security)

bjorn-voesten/ciphersweet-for-laravel
=====================================

1.4.0(2y ago)1411.6k↑33.3%13[1 issues](https://github.com/bjornvoesten/ciphersweet-for-laravel/issues)[1 PRs](https://github.com/bjornvoesten/ciphersweet-for-laravel/pulls)MITPHPPHP ^7.2.5|^8.0

Since Nov 2Pushed 2y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (6)Versions (9)Used By (0)

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.

```
