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

ActiveLibrary[Security](/categories/security)

sentinelphp/encrypt
===================

Sodium-based encryption library for sensitive data

v1.0.1(2mo ago)00GPL-3.0-or-laterPHP &gt;=8.2

Since Apr 27Compare

[ Source](https://github.com/SentinelPHP/Encrypt)[ Packagist](https://packagist.org/packages/sentinelphp/encrypt)[ Docs](https://github.com/SentinelPHP/encrypt)[ RSS](/packages/sentinelphp-encrypt/feed)WikiDiscussions Synced 3w ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

Sentinel Encrypt
================

[](#sentinel-encrypt)

[![Latest Version](https://camo.githubusercontent.com/feaa3f2b13e083e23cb3a33c30be6288e2284cb2391d89e631e91b1a105e1b5c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73656e74696e656c7068702f656e63727970742e737667)](https://packagist.org/packages/sentinelphp/encrypt)[![License](https://camo.githubusercontent.com/1d102693e6dcdc444f542a5301742152535b0fde21a0c763e6e42fe1661a37fc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73656e74696e656c7068702f656e63727970742e737667)](https://github.com/SentinelPHP/encrypt/blob/main/LICENSE)

Sodium-based encryption library for sensitive data protection.

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

[](#installation)

```
composer require sentinelphp/encrypt
```

**Requirements:** PHP 8.2+ with the `sodium` extension.

Usage
-----

[](#usage)

```
use SentinelPHP\Encrypt\Encryptor;

// Generate a new encryption key
$key = Encryptor::generateKey();

// Create encryptor with the key
$encryptor = new Encryptor($key);

// Encrypt data
$plaintext = 'sensitive data';
$ciphertext = $encryptor->encrypt($plaintext);

// Decrypt data
$decrypted = $encryptor->decrypt($ciphertext);
```

Key Management
--------------

[](#key-management)

```
use SentinelPHP\Encrypt\Encryptor;

// Generate a new key (base64-encoded)
$key = Encryptor::generateKey();
// Store this securely (e.g., environment variable, secrets manager)

// Check if encryption is enabled
$encryptor = new Encryptor($key);
if ($encryptor->isEnabled()) {
    $encrypted = $encryptor->encrypt($data);
}
```

Security
--------

[](#security)

This library uses:

- **XSalsa20-Poly1305** authenticated encryption
- **Random nonces** for each encryption operation
- **Constant-time** comparison for authentication

Error Handling
--------------

[](#error-handling)

```
use SentinelPHP\Encrypt\Encryptor;
use SentinelPHP\Encrypt\Exception\EncryptionException;
use SentinelPHP\Encrypt\Exception\InvalidKeyException;

try {
    $encryptor = new Encryptor($key);
    $decrypted = $encryptor->decrypt($ciphertext);
} catch (InvalidKeyException $e) {
    // Invalid or missing encryption key
} catch (EncryptionException $e) {
    // Encryption/decryption failed (tampered data, wrong key, etc.)
}
```

License
-------

[](#license)

GPL v3 — see LICENSE for details

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance83

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

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

2

Last Release

88d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3542330?v=4)[Tommy Lynge Jørgensen](/maintainers/TLyngeJ)[@TLyngeJ](https://github.com/TLyngeJ)

---

Tags

securityencryptionsodiumdata protection

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[phpseclib/phpseclib

PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.

5.6k465.6M1.6k](/packages/phpseclib-phpseclib)[defuse/php-encryption

Secure PHP Encryption Library

3.9k175.2M258](/packages/defuse-php-encryption)[ass/xmlsecurity

The XmlSecurity library is written in PHP for working with XML Encryption and Signatures

955.7M35](/packages/ass-xmlsecurity)[nzo/url-encryptor-bundle

The NzoUrlEncryptorBundle is a Symfony Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

971.1M2](/packages/nzo-url-encryptor-bundle)[tilleuls/url-signer-bundle

Create and validate signed URLs with a limited lifetime in Symfony

81369.3k](/packages/tilleuls-url-signer-bundle)[ercsctt/laravel-file-encryption

Secure file encryption and decryption for Laravel applications

778.3k1](/packages/ercsctt-laravel-file-encryption)

PHPackages © 2026

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