PHPackages                             nzo/url-encryptor-bundle - 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. nzo/url-encryptor-bundle

ActiveSymfony-bundle[Security](/categories/security)

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

v6.5.0(7mo ago)971.1M↓30.5%192MITPHPPHP &gt;=7.1.3CI failing

Since Jan 29Pushed 7mo ago5 watchersCompare

[ Source](https://github.com/NAYZO/NzoUrlEncryptorBundle)[ Packagist](https://packagist.org/packages/nzo/url-encryptor-bundle)[ RSS](/packages/nzo-url-encryptor-bundle/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (6)Versions (51)Used By (2)Security (1)

NzoUrlEncryptorBundle
=====================

[](#nzourlencryptorbundle)

[![tests](https://github.com/nayzo/NzoUrlEncryptorBundle/actions/workflows/tests.yaml/badge.svg)](https://github.com/nayzo/NzoUrlEncryptorBundle/actions/workflows/tests.yaml)[![Total Downloads](https://camo.githubusercontent.com/79f4db9353f235d72eb4b158322b11c54a2923c471a8d55321a3e7720b747e31/68747470733a2f2f706f7365722e707567782e6f72672f6e7a6f2f75726c2d656e63727970746f722d62756e646c652f646f776e6c6f616473)](https://packagist.org/packages/nzo/url-encryptor-bundle)[![Latest Stable Version](https://camo.githubusercontent.com/56c478d783d0c6167b1f99b236decf0ca02a8b2d2b494f235c219c95be5f9132/68747470733a2f2f706f7365722e707567782e6f72672f6e7a6f2f75726c2d656e63727970746f722d62756e646c652f762f737461626c65)](https://packagist.org/packages/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 the `URL` to provide more security to the project. Also it prevent users from reading and modifying sensitive data sent through the `URL`.

#### The Version (^6.0) is compatible with **Symfony &gt;= 4.4**

[](#the-version-60-is-compatible-with-symfony--44)

Features include:

- Url Data &amp; parameters Encryption
- Url Data &amp; parameters Decryption
- Data Encryption &amp; Decryption
- Access from Twig by ease
- Flexible configuration
- Uses OpenSSL extension

By default, this bundle use the **aes-256-ctr** algorithm.

CTR mode (without any additional authentication step) is malleable, which means that it is possible to change the meaning of the ciphertext and if the plaintext is guessable then it could lead to IDOR.

##### For more secure output, you must configure the bundle to use a **unique and random IV** (`random_pseudo_bytes: TRUE`)

[](#for-more-secure-output-you-must-configure-the-bundle-to-use-a-unique-and-random-iv-random_pseudo_bytes-true)

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

[](#installation)

### Through Composer:

[](#through-composer)

Install the bundle:

```
$ composer require nzo/url-encryptor-bundle

```

### Register the bundle in config/bundles.php (without Flex):

[](#register-the-bundle-in-configbundlesphp-without-flex)

```
// config/bundles.php

return [
    // ...
    Nzo\UrlEncryptorBundle\NzoUrlEncryptorBundle::class => ['all' => true],
];
```

### Configure the bundle:

[](#configure-the-bundle)

```
# config/packages/nzo_encryptor.yaml

nzo_encryptor:
    secret_key: Your_Secret_Encryption_Key   # Required, max length of 100 characters.
    secret_iv:  Your_Secret_Iv               # Required only if "random_pseudo_bytes" is FALSE. Max length of 100 characters.
    cipher_algorithm:                        # optional, default: 'aes-256-ctr'
    base64_encode:                           # optional, default: TRUE
    format_base64_output:                    # optional, default: TRUE, used only when 'base64_encode' is set to TRUE
    random_pseudo_bytes:                     # optional, default: TRUE (generate a random encrypted text output each time => MORE SECURE !)
```

##### \* To generate the same cypher text each time: `random_pseudo_bytes: FALSE` (Not Secure)

[](#-to-generate-the-same-cypher-text-each-time-random_pseudo_bytes-false-not-secure)

##### \* To generate a different cypher text each time: `random_pseudo_bytes: TRUE` (Secure)

[](#-to-generate-a-different-cypher-text-each-time-random_pseudo_bytes-true-secure)

Usage
-----

[](#usage)

#### In the twig template:

[](#in-the-twig-template)

Use the twig extensions filters or functions to `encrypt` or `decrypt` your data:

```
// Filters:

# Encryption:

     My link

    {{myVar | nzo_encrypt }}

# Decryption:

     My link

    {{myVar | nzo_decrypt }}

// Functions:

# Encryption:

     My link

    {{ nzo_encrypt(myVar) }}

# Decryption:

     My link

    {{ nzo_decrypt(myVar) }}
```

#### In the controller with annotation service:

[](#in-the-controller-with-annotation-service)

Use the annotation service to `decrypt` / `encrypt` automatically any parameter you want, by using the `ParamDecryptor` / `ParamEncryptor` annotation service and specifying in it all the parameters to be decrypted/encrypted.

```
use Nzo\UrlEncryptorBundle\Annotations\ParamDecryptor;
use Nzo\UrlEncryptorBundle\Annotations\ParamEncryptor;

class MyController
{
    /**
    * @ParamDecryptor({"id", "foo"})
    */
    // OR
    #[ParamDecryptor(["id", "foo"])]
    public function decryptionAction($id, $foo)
    {
        // no need to use the decryption service here as the parameters are already decrypted by the annotation service.
        //...
    }

    /**
    * @ParamEncryptor({"id", "foo"})
    */
    // OR
    #[ParamEncryptor(["id", "foo"])]
    public function encryptionAction($id, $foo)
    {
        // no need to use the encryption service here as the parameters are already encrypted by the annotation service.
        //...
    }
}
```

#### With autowiring:

[](#with-autowiring)

```
use Nzo\UrlEncryptorBundle\Encryptor\Encryptor;

class MyController
{
    private $encryptor;

    public function __construct(Encryptor $encryptor)
    {
        $this->encryptor = $encryptor;
    }

    public function indexAction($data)
    {
        $encrypted = $this->encryptor->encrypt($data);

        $decrypted = $this->encryptor->decrypt($data);
    }
}
```

#### Without autowiring:

[](#without-autowiring)

```
class MyController
{
    public function indexAction($data)
    {
        $encrypted = $this->get('nzo_encryptor')->encrypt($data);

        $decrypted = $this->get('nzo_encryptor')->decrypt($data);
    }
}
```

License
-------

[](#license)

This bundle is under the MIT license. See the complete license in the bundle:

See [LICENSE](https://github.com/nayzo/NzoUrlEncryptorBundle/tree/master/LICENSE)

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance65

Regular maintenance activity

Popularity54

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 96.5% 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 ~82 days

Recently: every ~174 days

Total

49

Last Release

214d ago

Major Versions

v4.3.0 → v5.0.02019-12-18

v4.3.1 → v5.0.12020-05-03

v4.3.2 → v5.1.02020-06-25

v4.5.0 → v5.2.02020-06-25

v5.2.0 → v6.0.02020-09-25

PHP version history (4 changes)1.0PHP &gt;=5.3.3

v4.3.0PHP &gt;=5.3.9

v5.0.0PHP ^7.2.5

v6.0.0PHP &gt;=7.1.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/43973d4c7b23026540ed9f2670200cbd664d7ae7c55126feb465e62ba7a2a86f?d=identicon)[nayzo](/maintainers/nayzo)

---

Top Contributors

[![nayzo](https://avatars.githubusercontent.com/u/1272883?v=4)](https://github.com/nayzo "nayzo (110 commits)")[![amallet42](https://avatars.githubusercontent.com/u/218805333?v=4)](https://github.com/amallet42 "amallet42 (1 commits)")[![DemigodCode](https://avatars.githubusercontent.com/u/36764562?v=4)](https://github.com/DemigodCode "DemigodCode (1 commits)")[![dzuelke](https://avatars.githubusercontent.com/u/27900?v=4)](https://github.com/dzuelke "dzuelke (1 commits)")[![lucasfoussier](https://avatars.githubusercontent.com/u/27965760?v=4)](https://github.com/lucasfoussier "lucasfoussier (1 commits)")

---

Tags

urllinksecurityencryptionaesdataencryptdecryptidvariabledecryption

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nzo-url-encryptor-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/nzo-url-encryptor-bundle/health.svg)](https://phpackages.com/packages/nzo-url-encryptor-bundle)
```

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k175.2M254](/packages/defuse-php-encryption)[poly-crypto/poly-crypto

High-level cryptographic functions that are interoperable between NodeJS and PHP 7.1+

128.1k1](/packages/poly-crypto-poly-crypto)

PHPackages © 2026

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