wemxo / encryption-bundle
Useful symfony bundle that offers the possibility to encrypt/decrypt sensitive data.
Installs: 15
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 0
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=8.0.2
- ext-openssl: *
- symfony/framework-bundle: ^6.0|^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.65
- symfony/phpunit-bridge: ^6.0|^7.0
This package is auto-updated.
Last update: 2025-06-10 02:31:42 UTC
README
The encryption bundle is a symfony bundle that allow you to encrypt and decrypt sensitive data based on a given encryption key, sipher algorithm and digest method.
Usage
1- Configuration
# /config/packages/encryption.yaml
encryption:
password:
encryption_key: hO!}098iKko_hf
email:
encryption_key: '%my_key_parameter%'
cypher_algorithm: aes128
digest_method: md5
With this configuration, you will have access to a private service (instance of
Wemxo\EncryptionBundle\Encryption\EncryptionInterface
) in container named@wemxo.encryption.password
with an alias$passwordEncryption
.
2- Example
<?php
namespace App;
classe MyService {
public function __construct(private EncryptionInterface $passwordEncryption, private EncryptionInterface $emailEncryption)
{
}
public function testEncryptPassword(string $text): string
{
return $this->passwordEncryption->encrypt($text);
}
public function testDecryptPassword(string $text): string
{
return $this->passwordEncryption->decrypt($text);
}
}