codezero/encrypter
最新稳定版本:2.0.2
Composer 安装命令:
composer require codezero/encrypter
包简介
Encrypt and decrypt strings in PHP.
README 文档
README
Encrypt and decrypt strings in PHP.
This package includes an adapter for Laravel's Encrypter that adheres to my Encrypter interface.
This can be used in vanilla PHP. Other implementations might be added in the future.
Installation
Install this package through Composer:
composer require codezero/encrypter
Vanilla PHP Implementation
Autoload the vendor classes:
require_once 'vendor/autoload.php'; // Path may vary
Choose a key. You will need the same key that was used to encrypt a string, to decrypt it.
$key = 'my secret key';
And then use the DefaultEncrypter implementation:
$encrypter = new \CodeZero\Encrypter\DefaultEncrypter($key);
Usage
Encrypt a string
$encrypted = $encrypter->encrypt('some string');
Decrypt an encrypted string
try { $decrypted = $encrypter->decrypt($encrypted); } catch (\CodeZero\Encrypter\DecryptException $exception) { // Decryption failed... }
Testing
$ composer run test
Security
If you discover any security related issues, please e-mail me instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 90k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-28