PHPackages                             leolopez/encrypt - 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. leolopez/encrypt

ActiveLibrary[Security](/categories/security)

leolopez/encrypt
================

Encrypts any field from a model, array or value.

1.1.2(4y ago)1791↓22.2%MITPHP

Since Apr 16Pushed 4y ago1 watchersCompare

[ Source](https://github.com/leolopez48/encrypt)[ Packagist](https://packagist.org/packages/leolopez/encrypt)[ RSS](/packages/leolopez-encrypt/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)DependenciesVersions (6)Used By (0)

Library for Laravel to Encrypt and Decrypt Models, Arrays and Values.
=====================================================================

[](#library-for-laravel-to-encrypt-and-decrypt-models-arrays-and-values)

[![Latest Stable Version](https://camo.githubusercontent.com/9ad0f64e74a079531704ecd28b9157a521bc785de30fe1dd0eea82d5c84e2840/687474703a2f2f706f7365722e707567782e6f72672f6c656f6c6f70657a2f656e63727970742f76)](https://packagist.org/packages/leolopez/encrypt) [![Total Downloads](https://camo.githubusercontent.com/4f92a2432920644946cc8c947e4156ee2fd2ee7ab545316911a4ad8da6a8c5e5/687474703a2f2f706f7365722e707567782e6f72672f6c656f6c6f70657a2f656e63727970742f646f776e6c6f616473)](https://packagist.org/packages/leolopez/encrypt) [![Latest Unstable Version](https://camo.githubusercontent.com/3b566e17bec5a1be4958769a9bb0f91daeae7e2909c6cc58dbf7de56676905bc/687474703a2f2f706f7365722e707567782e6f72672f6c656f6c6f70657a2f656e63727970742f762f756e737461626c65)](https://packagist.org/packages/leolopez/encrypt) [![License](https://camo.githubusercontent.com/ad31a3c5ca77214bce5c7f5e609980bccb66b5bdea081f74846219e9e49c6679/687474703a2f2f706f7365722e707567782e6f72672f6c656f6c6f70657a2f656e63727970742f6c6963656e7365)](https://packagist.org/packages/leolopez/encrypt) [![PHP Version Require](https://camo.githubusercontent.com/195cda53a542fe03c5e569729574489beff181dc0b28d73b4479a56a561e7c13/687474703a2f2f706f7365722e707567782e6f72672f6c656f6c6f70657a2f656e63727970742f726571756972652f706870)](https://packagist.org/packages/leolopez/encrypt)

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

[](#installation)

Install the package

```
composer require leolopez/encrypt

```

Register the service provider
-----------------------------

[](#register-the-service-provider)

Add the Service Provider in `config/app.php` into the `providers` section

```
Leolopez\Encrypt\EncryptServiceProvider::class

```

Add the Facade in `config/app.php` into the `aliases` section

```
'Encrypt' => Leolopez\Encrypt\Facades\Encrypt::class,

```

Available methods
=================

[](#available-methods)

Models
======

[](#models)

Encrypts columns of an array of object

```
encryptObject($array, $keys)

```

Decrypts columns of an array of object

```
decryptObject($array, $keys)

```

Encrypts a column of an Object

```
encryptValueObject($object, $key)

```

Decrypts a column of an Object

```
decryptValueObject($object, $key)

```

Arrays
======

[](#arrays)

Encrypts columns of an Array

```
encryptArray($array, $keys)

```

Decrypts columns of an Array

```
decryptArray($array, $keys)

```

Values
======

[](#values)

Encrypts a value

```
encryptValue($value)

```

Decrypts a value

```
decryptValue($key)

```

Example
-------

[](#example)

Encrypt a model value
=====================

[](#encrypt-a-model-value)

Go to your controller and import the facade

```
use Leolopez\Encrypt\Facades\Encrypt;

```

Send as a first parameter the array, and add the keys you want to encrypt

```
$users = User::all();
$users = Encrypt::encryptObject($users, ['id']);

```

Decrypt a model value
=====================

[](#decrypt-a-model-value)

Send as a first parameter the array, and add the keys you want to decrypt

```
$users = User::all();
$users = Encrypt::encryptObject($users, ['id']);

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

5

Last Release

1493d ago

PHP version history (2 changes)1.0.0PHP ^7.2

1.0.1PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/49a4e7008c35b29fb50504a2c0c41f80981eb096ef29b18f6d6db63529e087c1?d=identicon)[leolopez](/maintainers/leolopez)

---

Top Contributors

[![leolopez48](https://avatars.githubusercontent.com/u/41087207?v=4)](https://github.com/leolopez48 "leolopez48 (7 commits)")

### Embed Badge

![Health badge](/badges/leolopez-encrypt/health.svg)

```
[![Health](https://phpackages.com/badges/leolopez-encrypt/health.svg)](https://phpackages.com/packages/leolopez-encrypt)
```

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M113](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41478.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

87117.5M63](/packages/bjeavons-zxcvbn-php)[illuminate/encryption

The Illuminate Encryption package.

9229.7M280](/packages/illuminate-encryption)[paragonie/hidden-string

Encapsulate strings in an object to hide them from stack traces

7410.6M39](/packages/paragonie-hidden-string)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
