w360/secure-data

使用高级加密标准(AES)和数据加密标准(DES)加密MySQL数据库字段的库

3.0.1 2023-06-06 06:01 UTC

This package is auto-updated.

Last update: 2024-09-06 03:56:46 UTC


README

使用高级加密标准(AES)和数据加密标准(DES)加密MySQL数据库字段的库

runtest Total Downloads Latest Stable Version License

目录

安装

> composer require w360/secure-data

示例

  • 使用示例
<?php

namespace App\Models;

use Illuminate\Foundation\Auth\User as Authenticatable;
use W360\SecureData\Traits\HasEncryptedFields;


class User extends Authenticatable
{
    use HasEncryptedFields;


    /**
     * The attributes that are mass assignable.
     *
     *@var array
     */
    protected $fillable = [
        'first_name',
        'last_name',
        'email',
        'identifier',
        'salary',
        'status',
        'password'
    ];
    
    /**
     * The attributes that should be encrypted.
     *
     * @var array<string, string>
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
        'email' => Secure::class,
        'identifier' => Secure::class,
        'first_name' => Secure::class,
        'last_name' => Secure::class,
        'salary' => Secure::class,
        'status' => Secure::class,
    ];
    
}

功能

  • 它允许以自然的方式仅使用MySQL加密方法进行加密和解密SQL查询中的字段

贡献者

许可协议

MIT许可证(MIT)

版权所有(c)2023 Elbert Tous

特此授予任何人免费获取本软件及其相关文档文件(“软件”)的副本的权利,以便在不受限制的情况下处理软件,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或销售软件副本的权利,并允许向获得软件的人提供软件,前提是遵守以下条件

上述版权声明和本许可声明应包含在软件的所有副本或主要部分中。

软件按“原样”提供,不提供任何明示或暗示的保证,包括但不限于适销性、特定用途适用性和非侵权性保证。在任何情况下,作者或版权所有者均不对任何索赔、损害或其他责任负责,无论这些责任是根据合同、侵权或其他行为产生的,无论这些责任是否与软件或其使用或其他方式有关。