claudye/php-crypter
Composer 安装命令:
composer require claudye/php-crypter
包简介
Secure the data of your websites by encrypting them. They will be decrypted only in your applications with your secret key
README 文档
README
Secure the data of your websites by encrypting them. They will be decrypted only in your applications with your secret key
How to install ?
With composer
- Firstly you need composer
- Run the command
composer require claudye/php-crypter
Clone or download from github
- Clone or download from github
- Be sure you have composer installed
- Goto the root of your project and open there a shell (terminal)
- Run
composer install
Usage
When php crypter is successful installed, please import the Encryption class like :
use PHPCrypter\Encryption\Encryption;
- To encrypt a data, you use
Encryption::encrypt(string $text, string $algo_method="AES-128-CBC", string $token=null)This method requires the data to be encrypted, other arguments are optional. It returns encrypted data that you can store or write somewhere for reuse - To decrypt the encrypted information later you can use the method
Encryption::decrypt(string $data_encrypted)This method will use the generated key for you to decrypt the data which was encrypted. This key must be secret
Example
use PHPCrypter\Encryption\Encryption;
//You can define your key any where you want
//define("ENC_TOKEN_PATH", "your/dir/example");
require 'vendor/autoload.php';
// Encrypt the text "The only limit of a developer is his imagination"
$encrypt = Encryption::encrypt("The only limit of a developer is his imagination");
//You store the encrypted data in a file or in a database, or any where you can reuse it
//After you want to use it again on your site
//Get your text: $encrypt and then decrypt it
$decrypt = Encryption::decrypt($encrypt);
//All right !
Change encryption key path!
It is possible to change the encryption key path (file or directory) where you want to store the secret key! It's a good idea to choose a very secure path
All you have to do is define a constant called: ENC_TOKEN_PATH , in your project where our script can find it
Information
The encryption method used by default is : AES-128-CBC Find all the methods here
Attention!
When your data is encrypted with a key, only this key can decrypt it, so be careful not to lose your keys or change your keys carelessly.
claudye/php-crypter 适用场景与选型建议
claudye/php-crypter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 52 次下载、GitHub Stars 达 7, 最近一次更新时间为 2022 年 09 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 claudye/php-crypter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 claudye/php-crypter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 52
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-09-01