zeeshantariq/filament-sqlgen
Composer 安装命令:
composer require zeeshantariq/filament-sqlgen
包简介
A FilamentPHP package that generates SQL from natural language using Gemini AI.
README 文档
README
A FilamentPHP package that integrates a Gemini- or OpenAI-powered AI assistant into your Laravel admin panel — converting natural language into SQL and showing results in real-time.
Features
- Text-to-SQL AI: Converts natural language questions into SQL using Gemini or OpenAI and executes them securely.
- Read-only access: Executes only
SELECTqueries for safety. - Interactive UI: Results are rendered in a styled HTML table within the Filament widget.
- Easy setup: Plug-and-play widget for any FilamentPHP admin panel.
- AI provider config: Supports Gemini and OpenAI with flexible config options including temperature and token limits.
- History logging: Track all user queries and generated SQL with optional database logging.
Requirements
- Laravel 8 or above
- FilamentPHP 3.x or above
- A Gemini or OpenAI API key
Installation
Install via Composer:
composer require zeeshantariq/filament-sqlgen
Configuration
Publish Assets
You can publish configuration, views, migrations, or the schema separately:
🔧 Publish Config
php artisan vendor:publish --tag="filament-sqlgen-config"
🎨 Publish Views
php artisan vendor:publish --tag="filament-sqlgen-views"
📦 Publish Migrations
php artisan vendor:publish --tag="filament-sqlgen-migrations"
📊 Publish Schema File
php artisan vendor:publish --tag="filament-sqlgen-schema"
This will allow you to customize the package settings, views, schema, and database behavior individually.
Add your AI settings to .env
🔹 For Gemini:
AI_PROVIDER=gemini GEMINI_API_KEY=your-gemini-api-key GEMINI_API_ENDPOINT=https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent GEMINI_TEMPERATURE=0.2 GEMINI_MAX_OUTPUT_TOKENS=1024
🔹 For OpenAI:
AI_PROVIDER=openai OPENAI_API_KEY=your-openai-api-key OPENAI_MODEL=gpt-3.5-turbo OPENAI_API_ENDPOINT=https://api.openai.com/v1/chat/completions OPENAI_TEMPERATURE=0.2 OPENAI_MAX_TOKENS=1024
Configuration Notes:
- AI_PROVIDER: Choose between
geminiandopenai. - API Keys: Add the respective keys for each provider.
- Temperature and Max Tokens: Tune the model's creativity and output length.
Usage
Add the widget to your Filament dashboard or resource page:
use ZeeshanTariq\FilamentSqlGen\Filament\Widgets\SqlGenWidget; public static function getWidgets(): array { return [ SqlGenWidget::class, ]; }
Users can then type questions like:
"How many users signed up today?"
The AI will respond by generating and executing a query like:
SELECT COUNT(*) FROM users WHERE DATE(created_at) = CURDATE();
The results are shown in a neat, scrollable table.
Security
Only SELECT queries are allowed. All destructive operations like UPDATE, DELETE, or DROP are blocked.
Customization
To override the widget view:
- Publish the views as shown above.
- Modify the Blade file at:
resources/views/vendor/filament-sqlgen/widgets/sql-gen-widget.blade.php
You can style it with Tailwind or modify the layout/logic to fit your needs.
History Log
Track and store all SQL generation activity using the built-in logging model (SqlGenLog).
Contributing
Contributions are welcome! Please fork the repo, make changes, and open a pull request.
License
This package is open-source and licensed under the MIT license.
zeeshantariq/filament-sqlgen 适用场景与选型建议
zeeshantariq/filament-sqlgen 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.78k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 04 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「ai」 「Gemini」 「filament」 「filamentphp」 「google-ai」 「sqlgen」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 zeeshantariq/filament-sqlgen 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 zeeshantariq/filament-sqlgen 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 zeeshantariq/filament-sqlgen 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Filament plugin that integrates tabler icons, allowing you to use them seamlessly across Filament forms, tables, actions, and more.
jitone-ai is a powerful FilamentPHP plugin that integrates AI-powered features directly into your Filament forms.
Send Notification to discord channel Webhook using native FilamentPHP Notification Facade class
AI Agent templates for Laravel development - Skills, Agents, and Workflows for enhanced coding assistance
AI discussion summaries for Flarum with real-time streaming.
Filament administration, page editing, recovery, settings, and operations for Capell CMS.
统计信息
- 总下载量: 2.78k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-30