betterapp/laravel-db-encrypter
Composer 安装命令:
composer require betterapp/laravel-db-encrypter
包简介
Provides database model attribute encryption/decryption
关键字:
README 文档
README
This package was created to encrypt and decrypt values of Eloquent model attributes.
Donnations
If You think this package helped You, please donate. Thank You.
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SPYLWZ8Y5E4JE&source=url
Key features
- Encrypt, decrypt values stored in database fields
- Using standard Laravel's Crypt service
- Easy configuration
Installation
| Command | Laravel |
|---|---|
| composer install betterapp/laravel-db-encrypter:^v5 | 12 |
| composer install betterapp/laravel-db-encrypter:^v4 | 11 |
| composer install betterapp/laravel-db-encrypter:^v3 | 10 |
| composer install betterapp/laravel-db-encrypter:^v2 | 9 |
| composer install betterapp/laravel-db-encrypter:^v1 | 6, 7, 8 |
Requirements
- Laravel: 12
- PHP: 8.2 and newer
Database schema
Encrypted values are stored as plain text so in most cases takes up more spaces then unencrypted one.
Recommendation is to alter table column to TEXT type.
If you want use VARCHAR or CHAR column type still you need to check if encrypted value fit.
Note:
Do not worry if you have current data in your database not encrypted and added column to $encryptable - they will return as is.
On save values will be encrypted and everything will work fine.
Installation
Via Composer command line:
$ composer require betterapp/laravel-db-encrypter
Usage
- Use the
betterapp\LaravelDbEncrypter\Traits\EncryptableDbAttributetrait in any Eloquent model that you wish to use encryption - Define a
protected $encryptablearray containing a list of the encrypted attributes.
For example:
use betterapp\LaravelDbEncrypter\Traits\EncryptableDbAttribute;
class Client extends Eloquent {
use EncryptableDbAttribute;
/** @var array The attributes that should be encrypted/decrypted */
protected $encryptable = [
'id_number',
'email',
];
}
- You can use Laravel's original $casts to cast decrypted values
License
The MIT License (MIT). Please see License File for more information.
betterapp/laravel-db-encrypter 适用场景与选型建议
betterapp/laravel-db-encrypter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 652.94k 次下载、GitHub Stars 达 363, 最近一次更新时间为 2020 年 01 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「database」 「attribute」 「encryption」 「laravel」 「encrypt」 「decryption」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 betterapp/laravel-db-encrypter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 betterapp/laravel-db-encrypter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 betterapp/laravel-db-encrypter 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dibi is Database Abstraction Library for PHP
Store your language lines in the database, yaml or other sources
A simple PHP class to encrypt a string and decrypt an encrypted string
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Encryption with AES-256 and HMAC-SHA256
Allows installation of Laravel where the PHP Mcrypt extension is not available. Provides encryption using OpenSSL, or by disabling encryption entierly.
统计信息
- 总下载量: 652.94k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 364
- 点击次数: 34
- 依赖项目数: 8
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-01-12