承接 socfest/encrypted-types 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

socfest/encrypted-types

Composer 安装命令:

composer require socfest/encrypted-types

包简介

README 文档

README

Store database data encrypted

Encryption methods:

  • base64
  • openssl

Install

Require package via composer

composer require socfest/encrypted-types

Init bundle in bundles.php

# config/bundles.php
return [
    // for ODM
    Socfest\MongoDB\SocfestMongoEncryptedTypesBundle::class => ['all' => true],
    
    //for ORM
    Socfest\ORM\SocfestORMEncryptedTypesBundle::class => ['all' => true],
]

You can specify the openssl cipher method by enter this to .env file.

See the php.net openssl_cipher_iv_length page (https://www.php.net/manual/en/function.openssl-cipher-iv-length.php)

OPENSSL_CIPHER=%cipher_method%

Usage

ODM

In the model you can specify the field type. The new encrypted types are:

  • encrypted_openssl
  • encrypted_base64
/**
 * @var string
 * @MongoDB\Field(type="encrypted_openssl")
 */
protected $fullName;

In query you can find by full value, and you have to encrypt before set to equals.

Don't forget to use the correct encrypter!

$this->dm->getRepository(User::class)
    ->createQueryBuilder()
    ->field('fullName')
    ->equals(OpenSSLEncrypter::encrypt('X Y'))
    ->getQuery()
    ->execure()
);

also work with find methods

$this->dm->getRepository(User::class)
    ->findOneBy([
        'fullName' => OpenSSLEncrypter::encrypt('X Y')
    ])

统计信息

  • 总下载量: 206
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-01-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固