mozafar / encbuddy
用于加密响应内容和解密请求数据体的包
v1.2.3
2023-04-25 17:49 UTC
Requires
- php: >=7.0
- illuminate/config: ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0
- illuminate/encryption: ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0
- illuminate/http: ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0
- illuminate/support: ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-08-31 00:29:51 UTC
README
Laravel 包,用于加密响应内容和解密请求数据体
安装
1. 使用 composer 安装包
composer require mozafar/encbuddy
2. 发布配置文件
php artisan vendor:publish --tag=encbuddy-config
3. 将其添加到 Laravel 全局中间件
protected $middleware = [ . . ., \Mozafar\EncBuddy\EncBuddyMiddleware::class, ];
4. 注册开发路由
Route::encryption();
自定义密钥解析器
要从其他来源(如您的数据库或文件)获取密钥,可以使用实现 \Mozafar\EncBuddy\KeyResolverInterface
的类,以下是一个示例
namespace Your\Name\Space; class MyKeyResolver implements KeyResolverInterface { public function key(): string { return 'My custom key'; } }
您可以在配置文件中添加实现的类
/* |-------------------------------------------------------------- | Custom class to get key and cipher |-------------------------------------------------------------- | If set this config to null then constant key will | be used */ 'custom_key_resolver' => \Your\Name\Space\MyKeyResolver::class,