{"id":20560670,"url":"https://github.com/nicolasmure/nmureencryptorbundle","last_synced_at":"2026-03-02T03:36:23.785Z","repository":{"id":57027807,"uuid":"55188699","full_name":"nicolasmure/NmureEncryptorBundle","owner":"nicolasmure","description":"A Symfony Bundle for the nmure/encryptor library.","archived":false,"fork":false,"pushed_at":"2017-12-02T19:39:44.000Z","size":29,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-05T10:16:09.385Z","etag":null,"topics":["bundle","encryptor","openssl","php","symfony"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nicolasmure.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-31T23:04:38.000Z","updated_at":"2016-11-24T23:44:01.000Z","dependencies_parsed_at":"2022-08-23T16:20:40.853Z","dependency_job_id":null,"html_url":"https://github.com/nicolasmure/NmureEncryptorBundle","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolasmure%2FNmureEncryptorBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolasmure%2FNmureEncryptorBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolasmure%2FNmureEncryptorBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolasmure%2FNmureEncryptorBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nicolasmure","download_url":"https://codeload.github.com/nicolasmure/NmureEncryptorBundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224873072,"owners_count":17384078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bundle","encryptor","openssl","php","symfony"],"created_at":"2024-11-16T03:55:23.376Z","updated_at":"2026-03-02T03:36:23.758Z","avatar_url":"https://github.com/nicolasmure.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NmureEncryptorBundle\n\n[![Build Status](https://travis-ci.org/nicolasmure/NmureEncryptorBundle.svg?branch=master)](https://travis-ci.org/nicolasmure/NmureEncryptorBundle)\n[![Coverage Status](https://coveralls.io/repos/github/nicolasmure/NmureEncryptorBundle/badge.svg?branch=master)](https://coveralls.io/github/nicolasmure/NmureEncryptorBundle?branch=master)\n\nA Symfony Bundle for the [nmure/encryptor](https://github.com/nicolasmure/NmureEncryptor \"PHP data encryptor using open_ssl\") library.\n\n## Table of contents\n\n- [Introduction](#introduction)\n- [Installation](#installation)\n    - [Step 1 : Download the Bundle](#step-1--download-the-bundle)\n    - [Step 2 : Enable the Bundle](#step-2--enable-the-bundle)\n    - [Step 3 : Configure the Bundle](#step-3--configure-the-bundle)\n- [Usage](#usage)\n- [Configuration](#configuration)\n- [Formatters](#formatters)\n- [Informations](#informations)\n- [License](#license)\n- [Issues / feature requests](#issues--feature-requests)\n- [Changes](#changes)\n\n## Introduction\n\nThis Bundle integrates the [nmure/encryptor](https://github.com/nicolasmure/NmureEncryptor \"PHP data encryptor using open_ssl\") library into Symfony.\nIt is **recommended** to read the lib's documentation before continuing here.\n\n## Installation\n\n### Step 1 : Download the Bundle\n\nOpen a command console, enter your project directory and execute the\nfollowing command to download the latest stable version of this bundle:\n\n```bash\n$ composer require nmure/encryptor-bundle \"~2.0.0\"\n```\n\nFor Symfony \u003c 4.0, run\n```bash\n$ composer require nmure/encryptor-bundle \"~1.0.0\"\n```\n\nThis command requires you to have Composer installed globally, as explained\nin the [installation chapter](https://getcomposer.org/doc/00-intro.md)\nof the Composer documentation.\n\n### Step 2 : Enable the Bundle\n\nThen, enable the bundle by adding it to the list of registered bundles\nin the `app/AppKernel.php` file of your project:\n\n```php\n// app/AppKernel.php\nclass AppKernel extends Kernel\n{\n    public function registerBundles()\n    {\n        $bundles = array(\n            // ...\n            new Nmure\\EncryptorBundle\\NmureEncryptorBundle(),\n            // ...\n        );\n    }\n}\n```\n\n### Step 3 : Configure the Bundle\n\nAdd the following configuration to your `config.yml` file :\n```yaml\n# app/config/config.yml\nnmure_encryptor:\n    encryptors:\n        my_encryptor:\n            secret: 452F93C1A737722D8B4ED8DD58766D99 # should be a complex key defined in your parameters.yml file\n        # you can add as many encryptors as you want\n        my_other_encryptor:\n            secret: 6A4E723D3F4AA81ACF776DCF2B6AEC45 # you should use one unique secret key by encryptor\n```\n\n## Usage\nYou can access to the encryptors defined in the `config.yml` file by specifying your encryptor's name, e.g. :\naccessing to `nmure_encryptor.my_encryptor` will return the encryptor defined under the `my_encryptor` key.\n\nAll the encryptors are instances of the [`Nmure\\Encryptor\\Encryptor`](https://github.com/nicolasmure/NmureEncryptor/blob/master/src/Encryptor.php \"Nmure\\Encryptor\\Encryptor\") class.\nTo use them, call the `encrypt` / `decrypt` functions :\n```php\n// from a controller :\n$encryptor = $this-\u003eget('nmure_encryptor.my_encryptor');\n$encrypted = $encryptor-\u003eencrypt('hello world');\n// ...\n$decrypted = $encryptor-\u003edecrypt($encrypted);\n```\n\n## Configuration\n\nHere is the list of all the confifuration options that you can use\nin your `app/config.yml` file under the `nmure_encryptor` key:\n- `encryptors` : array, **required**. The main array of encryptors.\nMust contain at least one encryptor.\n    - `my_encryptor` : creates a new encryptor service named `nmure_encryptor.my_encryptor`.\n        - `secret` : string, **required**. The secret encryption key.\n        - `cipher` : string, optional. The cipher method (default to `AES-256-CBC`).\n        - `turn_hex_key_to_bin` : boolean, optional. Indicates if the hex secret key given above\n        should be converted to a binary key. This could be useful when [sharing encrypted data\n        with C# apps](https://github.com/nicolasmure/NmureEncryptor#using-the-hexformatter-with-a-c-app \"Using the HexFormatter with a C# app\")\n        for instance.\n        - `formatter` : string, optional. The service name of the [formatter](#formatters) to use with this encryptor.\n        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\").\n        - `disable_auto_iv_update` : boolean, optional. Set it to true if you want to disable\n        the automatic IV generation on the encryptor before each encryption.\n        The automatic IV update is enabled by default.\n    - `second_encryptor` : here comes an other encryptor ... :)\n\n## Formatters\n\nThe bundle wraps the lib's [formatters](https://github.com/nicolasmure/NmureEncryptor#formatters)\ninto services that you can use when configuring your encryptors :\n- [`Base64Formatter`](https://github.com/nicolasmure/NmureEncryptor#base64formatter \"Nmure\\Encryptor\\Formatter\\Base64Formatter\") =\u003e `nmure_encryptor.formatters.base64_formatter`\n- [`HexFormatter`](https://github.com/nicolasmure/NmureEncryptor#hexformatter \"Nmure\\Encryptor\\Formatter\\HexFormatter\") =\u003e `nmure_encryptor.formatters.hex_formatter`\n\n**Note** : If you use Symfony \u003e= 4.0, these services will be declared as `private`.\n\n## Informations\n\nUseful informations about:\n- [PHP's openssl](http://thefsb.tumblr.com/post/110749271235/using-opensslendecrypt-in-php-instead-of \"Using openssl_en/decrypt() in PHP instead of Mcrypt\")\n- [Initialization Vector usage](http://stackoverflow.com/questions/11821195/use-of-initialization-vector-in-openssl-encrypt \"Use of Initialization Vector in openssl_encrypt\")\n\n## License\n\nThis Bundle is licensed under the MIT License.\nMore informations in the [LICENSE](/LICENSE) file.\n\n## Issues / feature requests\n\nPlease use this Github repository page to report issues and to ask / propose features.\n\n## Changes\n\nSee the [changelog](/CHANGELOG.md \"changelog\") for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicolasmure%2Fnmureencryptorbundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicolasmure%2Fnmureencryptorbundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicolasmure%2Fnmureencryptorbundle/lists"}