jfnetwork / doctrine-encrypted-object
Doctrine mapping type to store encrypted objects
Installs: 399
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=8.1
- doctrine/orm: ^2.5
- symfony/config: 5.*|6.*|7.*
- symfony/console: 5.*|6.*|7.*
- symfony/dependency-injection: 5.*|6.*|7.*
- symfony/http-kernel: 5.*|6.*|7.*
- symfony/service-contracts: *
Suggests
- ext-openssl: *
- ext-sodium: *
- defuse/php-encryption: ^2.1
README
This bundle implement a doctrine mapping type for objects, that should be encrypted in storage.
Install
The bundle can be installed with composer:
composer require jfnetwork/doctrine-encrypted-object
For Sodium or Openssl encryption are corresponding PHP extensions required. For Defuse
is defuse/php-encryption package required
Sample Configuration
you should provide two environment variables:
DOCTRINE_ENCRYPTED_OBJECT_KEY=xxx DOCTRINE_ENCRYPTED_OBJECT_ENCRYPTION_WAY=sodium
The DOCTRINE_ENCRYPTED_OBJECT_ENCRYPTION_WAY
variable is optional and has value sodium
by default.
The DOCTRINE_ENCRYPTED_OBJECT_KEY
variable should be generated with the command:
bin/console jf:doctrine-encrypted-object:create-key {encryption_way}
where encryption way is one of sodium
, openssl
, defuse
Usage
Annotations
/** * @ORM\Column(name="your_secure_field", type="encoded_object") */ private $yourSecureField;
Attributes
use Jfnetwork\DoctrineEncryptedObject\DoctrineEncryptedObject; #[ORM\Column(type: DoctrineEncryptedObject::TYPE_NAME)] private $yourSecureField;
Upgrade from 2.0 to 3.0
You should set DOCTRINE_ENCRYPTED_OBJECT_ENCRYPTION_WAY
environment variable to defuse
. No other configuration is required. Some migration tool to other encryption ways will be provided later.