定制 payamjafari/laravel-db-encrypter 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

payamjafari/laravel-db-encrypter

最新稳定版本:v1.1.1

Composer 安装命令:

composer require payamjafari/laravel-db-encrypter

包简介

Provides database model attribute encryption/decryption

README 文档

README

This package was created to encrypt and decrypt values of Eloquent model attributes.

🔷 🔷 🔷 🔷

🔷 🔷 🔷 🔷

Works on jenssegers/mongodb now

🔷 🔷 🔷 🔷

🔷 🔷 🔷 🔷

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

Requirements

  • Laravel: 6.0 and up
  • PHP: 7.1 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 payamjafari/laravel-db-encrypter

Usage

  1. Use the betterapp\LaravelDbEncrypter\Traits\EncryptableDbAttribute trait in any Eloquent model that you wish to use encryption
  2. Define a protected $encryptable array containing a list of the encrypted attributes.

For example:

use Jenssegers\Mongodb\Eloquent\Model;
use betterapp\LaravelDbEncrypter\Traits\EncryptableDbAttribute;

class Client extends Model {
    use EncryptableDbAttribute;

    /** @var array The attributes that should be encrypted/decrypted */
    protected array $encryptable = [
        'id_number', 
        'email',
    ];
}
  1. You can use Laravel's original $casts to cast decrypted values

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 284
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 47
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-11-21