hemiframe/php-aes
Composer 安装命令:
composer require hemiframe/php-aes
包简介
PHP class for encrypt and decrypt data with AES algorithm
README 文档
README
Supports
- custom iv
- auto generate iv
- encode and decode data
Requirements
PHP >= 7.1
Installation
Enter in composer.json
{
"require": {
"hemiframe/php-aes": "~1.2"
}
}
or run in console: php composer.phar require hemiframe/php-aes
Example
require_once('vendor/autoload.php'); $aes = new \HemiFrame\Lib\AES(); $aes->setKey("testkey"); $aes->setData("testdata"); $ivString = $aes->generateIv(); $aes->setIv($ivString); $encryptedString = $aes->encrypt(); $aes->setData($encryptedString); $decryptedString = $aes->decrypt(); echo "Available methods: " . implode(",", \HemiFrame\Lib\AES::getAvailableMethods()) . "<br/><br/>" . PHP_EOL; echo "IV string: " . $ivString . "<br/>" . PHP_EOL; echo "Encrypted string: " . $encryptedString . "<br/>" . PHP_EOL; echo "Decrypted string: " . $decryptedString . "<br/>" . PHP_EOL;
Documentation
Methods
/** * Get encrypt/decrypt key * @return string|null */ public function getKey(): string /** * Return encoded or decoded string * @return mixed */ public function getData(); /** * Get selected cipher method * @return string */ public function getMethod(): string /** * Get available cipher methods * @return array */ public function getAvailableMethods(bool $aliases = false): array /** * Gets selected iv string * @return string */ public function getIv(): string /** * Generate a iv string for selected method * @return string|bool */ public function generateIv(); /** * Gets the cipher iv length * @return int|bool */ public function getIvLength(); /** * Set encrypt/decrypt key * @param string $key * @return $this * @throws \InvalidArgumentException */ public function setKey(string $key): self /** * Set encrypt/decrypt method * @param string $method * @return $this * @throws \InvalidArgumentException */ public function setMethod(string $method); /** * Set iv string * @param string $iv * @return $this * @throws \InvalidArgumentException */ public function setIv(string $iv): self /** * Set encrypt/decrypt data * @param mixed $data * @return $this * @throws \InvalidArgumentException */ public function setData($data): self /** * Returns the encrypted string on success or FALSE on failure. * @return string|bool * @throws \InvalidArgumentException */ public function encrypt(); /** * The decrypted string on success or FALSE on failure. * @return mixed * @throws \InvalidArgumentException */ public function decrypt();
hemiframe/php-aes 适用场景与选型建议
hemiframe/php-aes 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 31.31k 次下载、GitHub Stars 达 10, 最近一次更新时间为 2017 年 12 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「aes」 「openssl」 「encrypt」 「decrypt」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hemiframe/php-aes 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hemiframe/php-aes 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hemiframe/php-aes 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PHP library to encrypt/decrypt secrets using OpenSSL.
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
AES cipher - FIPS 192 compliant
Platine Security provides a complete security system with encryption, hash support.
Encrypting fields in doctrine entities wit AES
A library for reading KeePass 2.x databases
统计信息
- 总下载量: 31.31k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 33
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-12-25