百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
L

laravel-db-encrypter

> 编程语言
开源

Laravel Db Encrypter 包 此包是为加密和解密 Eloquent 模型属性的值而创建的。 如果您认为此包对 Laravel 社区有所帮助,请考虑捐款。

363 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

Laravel Db Encrypter 包 此包是为加密和解密 Eloquent 模型属性的值而创建的。 如果您认为此包对 Laravel 社区有所帮助,请考虑捐款。

Laravel Db Encrypter Package

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:

bash
$ composer require betterapp/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:

php
    
    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',
        ];
    }
  1. You can use Laravel's original $casts to cast decrypted values

License

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

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

PHP

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言