webmavens/triki-obfuscator
Composer 安装命令:
composer require webmavens/triki-obfuscator
包简介
Laravel package for database obfuscation using Triki
README 文档
README
Introduction
Triki is a Laravel package that provides an obfuscated database dump using the Triki Crystal obfuscator. This package allows you to specify tables and columns to obfuscate while keeping selected columns intact.
Requirements
- Laravel
- PHP
- MySQL/pgSQL
- Crystal Language installed on your system/server
Important Note (For SQLite users)
If you are using SQLite, the dump will not obfuscate any data. It will only generate and download a plain SQL file containing the selected tables.
- There is no need to use or modify the
obfuscator.crfile for SQLite. - Ensure
sqlite3is installed on your server/system:
sudo apt install sqlite3 ## Installation To install the package, run the following command: ```sh composer require webmavens/triki-obfuscator
Configuration
php artisan vendor:publish --tag=triki-config
Environment Variables
Ensure your .env file contains database credentials:
DB_DATABASE=your_database
DB_USERNAME=your_username
DB_PASSWORD=your_password
Ensure your .env file contains mail configuration:
MAIL_MAILER=
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=
MAIL_PASSWORD=
Middleware Authentication Key
To protect Triki routes, add an authentication key in your .env file(If you not set, it will be web-mavens by default):
TRIKI_AUTH_KEY=your_secure_key
Optional Route Protection
Configure Authorized Emails:
Update the config/triki.php file to enable authentication and define the allowed emails:
'auth' => [ 'enabled' => true, 'authorized_emails' => [ 'your.email@example.com', 'another@example.com', ], ],
If you want to more secure your route then use authorized_emails in config/triki.php
Usage
Accessing the Dump Page
You can access the dump interface via the following URL in your browser:
http://yourdomain.com/triki/download?auth_key=web-mavens
When prompted, enter the authentication key specified in your .env file.
Generating a Dump
- Select the tables you want to keep in the database dump (unchecked tables will be ignored).
- Provide an email address where the notification will be sent.
- Click Start Dump.
Obfuscation Logic
The obfuscator.cr file in the root directory determines which columns to obfuscate. Example:
require "triki" obfuscator = Triki.new({ "users" => { "email" => :email, "password" => :keep, }, }) obfuscator.fail_on_unspecified_columns = false obfuscator.globally_kept_columns = %w[id created_at updated_at] obfuscator.obfuscate(STDIN, STDOUT)
If a table is not specified, it will be included in the dump without obfuscation. check https://github.com/josacar/triki for more detaisl.
Queue Job for Dump Generation
The dump generation process runs as a queued job to avoid timeouts. Ensure your queue worker is running:
php artisan queue:work
Support
For any issues, feel free to create an issue in the GitHub repository.
License
webmavens/triki-obfuscator 适用场景与选型建议
webmavens/triki-obfuscator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 68 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 04 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 webmavens/triki-obfuscator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 webmavens/triki-obfuscator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 68
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-07