macellan/laravel-encryption
Composer 安装命令:
composer require macellan/laravel-encryption
包简介
Provides flexible data encryption adapter for Laravel.
README 文档
README
Provides flexible data encryption adapter for Laravel. 2-step encryption is available. Adapter settings are encrypted with "encryption_key". Data is encrypted with adapters.
Requirement PHP 7.4+.
Installation
- Install Package
composer req macellan/laravel-encryption
- Preparing Database & Config File
php artisan vendor:publish --tag="encryption" - Run Migrations
php artisan migrate
- Default Configuration: config/encryption.php
<?php return [ /* |-------------------------------------------------------------------------- | Encrypt Adapter Options |-------------------------------------------------------------------------- */ 'options_encrypt' => true, /* |-------------------------------------------------------------------------- | Options Encryption Key. |-------------------------------------------------------------------------- */ 'encryption_key' => env('ENCRYPTION_KEY'), /* |-------------------------------------------------------------------------- | Encryption Adapters |-------------------------------------------------------------------------- */ 'adapters' => [ \Macellan\LaravelEncryption\Adapters\LocalAdapter::class, ], ];
Provider Commands
- List Provider:
php artisan encryption:list
- Create Provider:
php artisan encryption:create
- Edit Provider:
php artisan encryption:edit
- List Provider:
php artisan encryption:remove
- List Provider:
php artisan encryption:key:generate
Usage
<?php $data = [1,2,3]; // Data Encrypt-Decrypt $encrypt = app('encryption')->encrypt($data); $decrypt = app('encryption')->decrypt($encrypt)->data(); // Custom Encryption Provider $decrypt = app('encryption')->decrypt( new CryptedData(EncryptionProvider $provider, $cryptedData); );
统计信息
- 总下载量: 204
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-07-07