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

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

nmure/encryptor-bundle
======================

A Symfony Bundle for the nmure/encryptor library

v2.0.0(8y ago)211.9kMITPHPPHP &gt;=7.1

Since Apr 4Pushed 8y ago2 watchersCompare

[ Source](https://github.com/nicolasmure/NmureEncryptorBundle)[ Packagist](https://packagist.org/packages/nmure/encryptor-bundle)[ RSS](/packages/nmure-encryptor-bundle/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (5)Dependencies (2)Versions (6)Used By (0)

NmureEncryptorBundle
====================

[](#nmureencryptorbundle)

[![Build Status](https://camo.githubusercontent.com/f8637b017cab403218d43fe5ecf7c2144a2836644992f5aeb2ab849d00cf0377/68747470733a2f2f7472617669732d63692e6f72672f6e69636f6c61736d7572652f4e6d757265456e63727970746f7242756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/nicolasmure/NmureEncryptorBundle)[![Coverage Status](https://camo.githubusercontent.com/e2653bafe07fa1f48ad7690e122c93b3334f9c735f18e906acff726f7deb6511/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6e69636f6c61736d7572652f4e6d757265456e63727970746f7242756e646c652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/nicolasmure/NmureEncryptorBundle?branch=master)

A Symfony Bundle for the [nmure/encryptor](https://github.com/nicolasmure/NmureEncryptor "PHP data encryptor using open_ssl") library.

Table of contents
-----------------

[](#table-of-contents)

- [Introduction](#introduction)
- [Installation](#installation)
    - [Step 1 : Download the Bundle](#step-1--download-the-bundle)
    - [Step 2 : Enable the Bundle](#step-2--enable-the-bundle)
    - [Step 3 : Configure the Bundle](#step-3--configure-the-bundle)
- [Usage](#usage)
- [Configuration](#configuration)
- [Formatters](#formatters)
- [Informations](#informations)
- [License](#license)
- [Issues / feature requests](#issues--feature-requests)
- [Changes](#changes)

Introduction
------------

[](#introduction)

This Bundle integrates the [nmure/encryptor](https://github.com/nicolasmure/NmureEncryptor "PHP data encryptor using open_ssl") library into Symfony. It is **recommended** to read the lib's documentation before continuing here.

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

[](#installation)

### Step 1 : Download the Bundle

[](#step-1--download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require nmure/encryptor-bundle "~2.0.0"
```

For Symfony &lt; 4.0, run

```
$ composer require nmure/encryptor-bundle "~1.0.0"
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

### Step 2 : Enable the Bundle

[](#step-2--enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `app/AppKernel.php` file of your project:

```
// app/AppKernel.php
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Nmure\EncryptorBundle\NmureEncryptorBundle(),
            // ...
        );
    }
}
```

### Step 3 : Configure the Bundle

[](#step-3--configure-the-bundle)

Add the following configuration to your `config.yml` file :

```
# app/config/config.yml
nmure_encryptor:
    encryptors:
        my_encryptor:
            secret: 452F93C1A737722D8B4ED8DD58766D99 # should be a complex key defined in your parameters.yml file
        # you can add as many encryptors as you want
        my_other_encryptor:
            secret: 6A4E723D3F4AA81ACF776DCF2B6AEC45 # you should use one unique secret key by encryptor
```

Usage
-----

[](#usage)

You can access to the encryptors defined in the `config.yml` file by specifying your encryptor's name, e.g. : accessing to `nmure_encryptor.my_encryptor` will return the encryptor defined under the `my_encryptor` key.

All the encryptors are instances of the [`Nmure\Encryptor\Encryptor`](https://github.com/nicolasmure/NmureEncryptor/blob/master/src/Encryptor.php "Nmure\Encryptor\Encryptor") class. To use them, call the `encrypt` / `decrypt` functions :

```
// from a controller :
$encryptor = $this->get('nmure_encryptor.my_encryptor');
$encrypted = $encryptor->encrypt('hello world');
// ...
$decrypted = $encryptor->decrypt($encrypted);
```

Configuration
-------------

[](#configuration)

Here is the list of all the confifuration options that you can use in your `app/config.yml` file under the `nmure_encryptor` key:

- `encryptors` : array, **required**. The main array of encryptors. Must contain at least one encryptor.
    - `my_encryptor` : creates a new encryptor service named `nmure_encryptor.my_encryptor`.
        - `secret` : string, **required**. The secret encryption key.
        - `cipher` : string, optional. The cipher method (default to `AES-256-CBC`).
        - `turn_hex_key_to_bin` : boolean, optional. Indicates if the hex secret key given above should be converted to a binary key. This could be useful when [sharing encrypted data with C# apps](https://github.com/nicolasmure/NmureEncryptor#using-the-hexformatter-with-a-c-app "Using the HexFormatter with a C# app")for instance.
        - `formatter` : string, optional. The service name of the [formatter](#formatters) to use with this encryptor. You can create your own formatter, it has to implement the [`FormatterInterface`](https://github.com/nicolasmure/NmureEncryptor/blob/master/src/Formatter/FormatterInterface.php "Nmure\Encryptor\Formatter\FormatterInterface").
        - `disable_auto_iv_update` : boolean, optional. Set it to true if you want to disable the automatic IV generation on the encryptor before each encryption. The automatic IV update is enabled by default.
    - `second_encryptor` : here comes an other encryptor ... :)

Formatters
----------

[](#formatters)

The bundle wraps the lib's [formatters](https://github.com/nicolasmure/NmureEncryptor#formatters)into services that you can use when configuring your encryptors :

- [`Base64Formatter`](https://github.com/nicolasmure/NmureEncryptor#base64formatter "Nmure\Encryptor\Formatter\Base64Formatter") =&gt; `nmure_encryptor.formatters.base64_formatter`
- [`HexFormatter`](https://github.com/nicolasmure/NmureEncryptor#hexformatter "Nmure\Encryptor\Formatter\HexFormatter") =&gt; `nmure_encryptor.formatters.hex_formatter`

**Note** : If you use Symfony &gt;= 4.0, these services will be declared as `private`.

Informations
------------

[](#informations)

Useful informations about:

- [PHP's openssl](http://thefsb.tumblr.com/post/110749271235/using-opensslendecrypt-in-php-instead-of "Using openssl_en/decrypt() in PHP instead of Mcrypt")
- [Initialization Vector usage](http://stackoverflow.com/questions/11821195/use-of-initialization-vector-in-openssl-encrypt "Use of Initialization Vector in openssl_encrypt")

License
-------

[](#license)

This Bundle is licensed under the MIT License. More informations in the [LICENSE](/LICENSE) file.

Issues / feature requests
-------------------------

[](#issues--feature-requests)

Please use this Github repository page to report issues and to ask / propose features.

Changes
-------

[](#changes)

See the [changelog](/CHANGELOG.md "changelog") for more details.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

Established project with proven stability

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

Total

5

Last Release

3086d ago

Major Versions

v0.3.0 → v1.0.02016-08-07

v1.0.0 → v2.0.02017-12-02

PHP version history (2 changes)v0.1.0PHP &gt;=5.4

v2.0.0PHP &gt;=7.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4362252?v=4)[Nicolas MURE](/maintainers/nicolasmure)[@nicolasmure](https://github.com/nicolasmure)

---

Top Contributors

[![nicolasmure](https://avatars.githubusercontent.com/u/4362252?v=4)](https://github.com/nicolasmure "nicolasmure (2 commits)")

---

Tags

bundleencryptoropensslphpsymfonysymfonybundlesecurityencryptiondataencryptdecrypthashsslopen

### Embed Badge

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

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

###  Alternatives

[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

961.0M2](/packages/nzo-url-encryptor-bundle)[xxtea/xxtea

XXTEA is a fast and secure encryption algorithm. This is a XXTEA library for PHP.

11341.7k](/packages/xxtea-xxtea)[rezzza/security-bundle

Signed requests check

1753.6k](/packages/rezzza-security-bundle)[poly-crypto/poly-crypto

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

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

PHPackages © 2026

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