limingxinleo / i-encryption
Illuminate Encryption for Hyperf
Installs: 477
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/limingxinleo/i-encryption
Requires
- php: >=7.2
- ext-json: *
- ext-mbstring: *
- ext-openssl: *
- hyperf/utils: ^2.0|^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- limingxinleo/happy-join-hyperf: ^1.0
- mockery/mockery: ^1.0
- phpstan/phpstan: ^1.0
- phpunit/phpunit: >=7.0
- swoole/ide-helper: dev-master
Replaces
README
安装
composer require limingxinleo/i-encryption
配置
<?php declare(strict_types=1); /** * This file is part of Hyperf. * * @link https://www.hyperf.io * @document https://hyperf.wiki * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ return [ 'default' => [ 'key' => '', 'cipher' => '', ], ];
使用
use Hyperf\Utils\ApplicationContext; use Illuminate\Encryption\Contracts\Encrypter; $encrypter = ApplicationContext::getContainer()->get(Encrypter::class); $encrypted = $encrypter->encrypt('foo'); $decrypted = $encrypter->decrypt($encrypted);