PHPackages                             minvws/laravel-crypto - 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. minvws/laravel-crypto

ActiveLibrary[Security](/categories/security)

minvws/laravel-crypto
=====================

Laravel provider for crypto functionality

v3.1.4(1y ago)33.2k1[2 issues](https://github.com/minvws/laravel-crypto/issues)EUPL-1.2PHPPHP ^8.0||^8.1||^8.2||^8.3CI failing

Since Oct 28Pushed 9mo ago13 watchersCompare

[ Source](https://github.com/minvws/laravel-crypto)[ Packagist](https://packagist.org/packages/minvws/laravel-crypto)[ RSS](/packages/minvws-laravel-crypto/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (10)Dependencies (7)Versions (18)Used By (0)

Laravel crypto package
======================

[](#laravel-crypto-package)

To learn more about the crypto used in the projects, please take a look at our [crypto doc](CRYPTO-README.md).

Requirements
------------

[](#requirements)

- PHP &gt;= 8.0
- Laravel &gt;= 8.0

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

[](#installation)

1. Install the package via composer:

```
composer require minvws/laravel-crypto
```

2. **If you are running Laravel 5.5 or higher (the package will be auto-discovered), skip this step.** Find the `providers` array key in `config/app.php` and register the **Laravel Crypto Service Provider**:

```
'providers' => [
    ...
    MinVWS\Laravel\Providers\CryptoServiceProvider::class,
];
```

Usage
=====

[](#usage)

This section describes the usage of the different crypto functionalities

CMS Crypto
----------

[](#cms-crypto)

CMS crypto allows you to easily encrypt (and possibly decrypt) data.

Usage:

```
class UserController {

    protected CmsCryptoInterface $service;

    function index()
    {
        $cipherText = $this->service->encrypt('plaintext');
        return new JsonResponse(['data' => $cipherText]);
    }
}
```

Sealbox Crypto
--------------

[](#sealbox-crypto)

```
class UserController {

    protected SealboxCryptoInterface $service;

    function index()
    {
        $cipherText = $this->service->encrypt('plaintext');
        return new JsonResponse(['data' => $cipherText]);
    }
}
```

Signatures
----------

[](#signatures)

```
class UserController {

    protected SignatureCryptoInterface $service;

    function index()
    {
        $sig = $this->service->sign('foobar', false);
        return new JsonResponse(['signature' => $sig]);
    }
}
```

### Laravel HTTP Middleware

[](#laravel-http-middleware)

Step 1: Add to `app/Http/Kernel.php`:

```
/*/ Package Middleware /*/
    ...
    'cms_sign' => \MinVWS\Crypto\Laravel\Http\Middleware\CmsSignature::class,
```

Step 2: Add your middleware to your routes:

```
Route::middleware('cms_sign')->post(
    '/my/route',
    [RouteController::class, 'index']
);
```

Environment vars
----------------

[](#environment-vars)

```
# OpenSSL CMS encryption
CMS_ENCRYPTION_CERT_PATHS        A comma separated list of x509 certificate paths that are used for encrypting data
CMS_DECRYPTION_CERT_PATH         A certificate file path that is used for decrypting data (optional)
CMS_DECRYPTION_CERT_KEY_PATH     The key file for the cert that is used for decrypting data (optional)

# LibSodium sealbox
CMS_SEAL_PRIVKEY            Our own private X25519 key
CMS_SEAL_RECIPIENT_PUBKEY   Public X25519 key of the recipient

# OpenSSL CMS signing
CMS_SIGN_X509_CERT          The certificate file to sign the data
CMS_SIGN_X509_KEY           The key file to sign the data
CMS_SIGN_X509_PASS          Optional passphrase for the key file
CMS_SIGN_X509_CHAIN         Optional chain of certificates to be added to the signed data

```

Running tests
=============

[](#running-tests)

Tests are run based on your PHP version. On PHP7, openssl functionality that is not available, will not be tested.

Running tests when you don't have PHP8 (but have docker):
---------------------------------------------------------

[](#running-tests-when-you-dont-have-php8-but-have-docker)

You can still test PHP8 functionality when running PHP7 by using the PHP8 docker image:

```
docker run -ti -w /app -v $PWD:/app php:8-cli php /app/vendor/bin/phpunit

```

Using code coverage on PHP8:

```
docker run -ti -w /app -v $PWD:/app php:8-cli phpdbg -qrr /app/vendor/bin/phpunit --coverage-html=./html

```

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~80 days

Recently: every ~229 days

Total

17

Last Release

413d ago

Major Versions

v1.3.0 → v2.0.02022-09-09

v2.0.3 → v3.0.02022-09-30

PHP version history (4 changes)v1.0.0PHP ^7.3|^7.4|^8.0

v1.3.0PHP ^7.3|^7.4|^8.0|^8.1

v2.0.0PHP ^8.0||^8.1||^8.2

v3.1.4PHP ^8.0||^8.1||^8.2||^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/35585f12d5551026d3cf7e8e25170cd718a16a5017096b3201ed196311ac51d9?d=identicon)[annejan](/maintainers/annejan)

![](https://www.gravatar.com/avatar/44e7cc7a950c1f964d8c8a5e3421d5fa61d6592add09ee3936ed267d75b2be33?d=identicon)[rdobeheer](/maintainers/rdobeheer)

---

Top Contributors

[![jaytaph](https://avatars.githubusercontent.com/u/241458?v=4)](https://github.com/jaytaph "jaytaph (23 commits)")[![nicktencate](https://avatars.githubusercontent.com/u/4581304?v=4)](https://github.com/nicktencate "nicktencate (11 commits)")[![ricklambrechts](https://avatars.githubusercontent.com/u/1367665?v=4)](https://github.com/ricklambrechts "ricklambrechts (10 commits)")[![annejan](https://avatars.githubusercontent.com/u/294470?v=4)](https://github.com/annejan "annejan (6 commits)")[![sigio](https://avatars.githubusercontent.com/u/781641?v=4)](https://github.com/sigio "sigio (4 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![randh1r](https://avatars.githubusercontent.com/u/17409257?v=4)](https://github.com/randh1r "randh1r (1 commits)")

---

Tags

laravelsecuritycryptographycryptosignature

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/minvws-laravel-crypto/health.svg)

```
[![Health](https://phpackages.com/badges/minvws-laravel-crypto/health.svg)](https://phpackages.com/packages/minvws-laravel-crypto)
```

###  Alternatives

[phpseclib/phpseclib

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

5.6k455.2M1.5k](/packages/phpseclib-phpseclib)[defuse/php-encryption

Secure PHP Encryption Library

3.9k170.7M239](/packages/defuse-php-encryption)[akaunting/laravel-firewall

Web Application Firewall (WAF) package for Laravel

1.0k494.9k2](/packages/akaunting-laravel-firewall)

PHPackages © 2026

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