reprovinci/doctrine-encrypt
Composer 安装命令:
composer require reprovinci/doctrine-encrypt
包简介
Package encrypts and decrypts Doctrine fields through life cycle events.
README 文档
README
Package encrypts and decrypts Doctrine fields through life cycle events.
Installation
Add reprovinci/doctrine-encrypt to your Composer manifest.
{ "require": { "reprovinci/doctrine-encrypt": "~3.0" } }
Configuration
Add the event subscriber to your entity manager's event manager. Assuming $em is your configured entity manager:
<?php # You should pick your own hexadecimal secret $secret = pack("H*", "dda8e5b978e05346f08b312a8c2eac03670bb5661097f8bc13212c31be66384c"); $subscriber = new DoctrineEncryptSubscriber( new \Doctrine\Common\Annotations\AnnotationReader, new \Reprovinci\DoctrineEncrypt\Encryptors\AES256Encryptor($secret) ); $eventManager = $em->getEventManager(); $eventManager->addEventSubscriber($encrypt_subscriber);
Usage
<?php namespace Your\Namespace; use Doctrine\ORM\Mapping as ORM; use Reprovinci\DoctrineEncrypt\Configuration\Encrypted; /** * @ORM\Entity */ class Entity { /** * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") * @ORM\Column(type="integer") * @var int */ protected $id; /** * @ORM\Column(type="text") * @Encrypted * @var string */ protected $secret_data; }
License
This bundle is under the MIT license. See the complete license in the bundle
Versions
I'm using Semantic Versioning like described here.
统计信息
- 总下载量: 5.1k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 2
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-06-26