PHPackages                             crudly/encrypted - 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. crudly/encrypted

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

crudly/encrypted
================

Encryption and hashing casts for Eloquent

1.6.0(1y ago)623.7k31MITPHPCI failing

Since Apr 26Pushed 1y ago3 watchersCompare

[ Source](https://github.com/Crudly/Encrypted)[ Packagist](https://packagist.org/packages/crudly/encrypted)[ Docs](https://github.com/crudly/encrypted)[ RSS](/packages/crudly-encrypted/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (3)Versions (15)Used By (1)

Encrypted
=========

[](#encrypted)

[![Build Status](https://camo.githubusercontent.com/ec78add4e2516a311a176910bc924f1f1feb317047975063fcdcc4d66669d003/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f637275646c792f456e637279707465642f6d61737465723f7374796c653d666c61742d737175617265)](https://travis-ci.org/crudly/encrypted)[![Release](https://camo.githubusercontent.com/9012ba8b313a58a2da0154f7f561da26f4cec30af6a0821e4d6ac88f17bb1836/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f637275646c792f456e637279707465643f7374796c653d666c61742d737175617265)](https://github.com/crudly/Encrypted/releases/latest)[![License](https://camo.githubusercontent.com/77e4d7c66840082880f74b4f72fd3e6744292a3367cff09671f1f4c9588a7766/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f637275646c792f656e637279707465643f7374796c653d666c61742d737175617265)](LICENSE)

> **Note** This package is no longer needed for new projects as [hashing is now](https://github.com/laravel/framework/pull/46947)among the native casts and encryption was there for a while already. We will probably keep it up to date for a few more years because it usually only takes bumping a version tag.

A custom cast class for Laravel Eloquent that encrypts or hashes your values. Package is small and provides just a few, simple, well tested features.

```
protected $casts = [
    // hashes the value when assigning to $model->password
    'password' => Password::class,

    // encrypts on write, decrypts on read
    'classified' => Encrypted::class,

    // encrypts on write, decrypts & typecasts on read
    'secret' => Encrypted::class.':integer',
];
```

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

[](#installation)

Use composer.

```
$ composer require crudly/encrypted
```

Usage
-----

[](#usage)

Mark any column in your model as encrypted.

```
