PHPackages                             brandoriented/doctrine-encryption-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. [Database &amp; ORM](/categories/database)
4. /
5. brandoriented/doctrine-encryption-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

brandoriented/doctrine-encryption-bundle
========================================

Doctrine encryption bundle for Symfony to aid with GDPR and general field encryption

1.1.1(7y ago)019MITPHPPHP &gt;=7

Since May 23Pushed 7y agoCompare

[ Source](https://github.com/BrandOriented/doctrine-encryption-bundle)[ Packagist](https://packagist.org/packages/brandoriented/doctrine-encryption-bundle)[ Docs](https://github.com/BrandOriented/doctrine-encryption-bundle)[ RSS](/packages/brandoriented-doctrine-encryption-bundle/feed)WikiDiscussions master Synced 2mo ago

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

Doctrine Encryption Bundle
==========================

[](#doctrine-encryption-bundle)

With GDPR becoming business critical here's a bundle that handles the data encryption layer.

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

[](#installation)

`composer require brandoriented/doctrine-encryption-bundle dev-master`

```
   app/AppKernel.php

    public function registerBundles()
    {
        $bundles = [
            ...
            new BrandOriented\Encryption\DoctrineEncryptionBundle(),
            ...
        ];
    }
```

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

[](#configuration)

***Basic***

Basic configuration will take advantage of the encryption library provided

```
doctrine_encryption:
  key: 'an encryption key'
  iv: 'an encryption iv'
  suffix: 'an encryption suffix'
```

***Full***

```
doctrine_encryption:
  key: 'an encryption key'
  iv: 'an encryption iv'
  suffix: 'an encryption suffix'
  method: 'AES-256-CBC' // This is the default setting
  class: 'Full\Namespace\To\Your\Encryptor' // If not supplied will use the default
```

Usage
-----

[](#usage)

### Using the encryption service in controller

[](#using-the-encryption-service-in-controller)

```
use BrandOriented\Encryption\Bridge\Bridge;

$this->get(Bridge::class)->encrypt($string)
$this->get(Bridge::class)->decrypt($string);
```

### Entity Annotation

[](#entity-annotation)

```
    use BrandOriented\Encryption\Annotation\Encrypted;

    class User {
       /**
       * @Encrypted()
       */
       private $firstname;

    }
```

The above will auto encrypt on `prePersist` and `preUpdate`

### Twig

[](#twig)

```
{{ user.firstname | decrypt }}
```

Design decision
---------------

[](#design-decision)

You'll notice there is no postLoad event to convert back to decrypted. Experience with doctrine is that as the entity is changed it adds it to the queue to be flushed. Say if you have an account with 1000 users each user would be decrypted meaning re saved.

How to add a custom Encryptor
-----------------------------

[](#how-to-add-a-custom-encryptor)

Create a class that extends `BrandOriented\Encryption\Encryptor\EncryptorInterface`. Then register as mentioned in the above config.

Tests
-----

[](#tests)

Yes there a loads of lovely unit tests :)

Roadmap
-------

[](#roadmap)

- Form inputs
- Command line util
- Travis integration

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 77.1% 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

Unknown

Total

1

Last Release

2909d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/233d0b00251744484000748877ee4d8d47e00446fa86a8cf9155e6f4d6b7ef48?d=identicon)[Effiana](/maintainers/Effiana)

---

Top Contributors

[![matt9mg](https://avatars.githubusercontent.com/u/8473296?v=4)](https://github.com/matt9mg "matt9mg (37 commits)")[![BrandOrientedTmp](https://avatars.githubusercontent.com/u/98951220?v=4)](https://github.com/BrandOrientedTmp "BrandOrientedTmp (11 commits)")

---

Tags

symfonybundleencryptionormdoctrinegdpr

### Embed Badge

![Health badge](/badges/brandoriented-doctrine-encryption-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/brandoriented-doctrine-encryption-bundle/health.svg)](https://phpackages.com/packages/brandoriented-doctrine-encryption-bundle)
```

###  Alternatives

[sonata-project/doctrine-orm-admin-bundle

Integrate Doctrine ORM into the SonataAdminBundle

46117.7M155](/packages/sonata-project-doctrine-orm-admin-bundle)[fresh/doctrine-enum-bundle

Provides support of ENUM type for Doctrine2 in Symfony applications.

4636.8M12](/packages/fresh-doctrine-enum-bundle)[omines/datatables-bundle

Symfony DataTables Bundle with native Doctrine ORM, Elastica and MongoDB support

2851.4M6](/packages/omines-datatables-bundle)[data-dog/audit-bundle

Audit bundle for symfony2 and doctrine orm, logs any database change

141901.7k1](/packages/data-dog-audit-bundle)

PHPackages © 2026

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