PHPackages                             zeeshantariq/filament-sqlgen - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. zeeshantariq/filament-sqlgen

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

zeeshantariq/filament-sqlgen
============================

A FilamentPHP package that generates SQL from natural language using Gemini AI.

v1.5.9(11mo ago)02.7k1MITPHPPHP ^8.1

Since Apr 30Pushed 11mo ago2 watchersCompare

[ Source](https://github.com/zeeshantariq08/filament-sqlgen)[ Packagist](https://packagist.org/packages/zeeshantariq/filament-sqlgen)[ RSS](/packages/zeeshantariq-filament-sqlgen/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (22)Used By (0)

filament-sqlgen
===============

[](#filament-sqlgen)

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
--------

[](#features)

- **Text-to-SQL AI**: Converts natural language questions into SQL using Gemini or OpenAI and executes them securely.
- **Read-only access**: Executes only `SELECT` queries 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
------------

[](#requirements)

- Laravel 8 or above
- FilamentPHP 3.x or above
- A Gemini or OpenAI API key

Installation
------------

[](#installation)

Install via Composer:

```
composer require zeeshantariq/filament-sqlgen
```

Configuration
-------------

[](#configuration)

### Publish Assets

[](#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`

[](#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:

[](#configuration-notes)

- **AI\_PROVIDER**: Choose between `gemini` and `openai`.
- **API Keys**: Add the respective keys for each provider.
- **Temperature and Max Tokens**: Tune the model's creativity and output length.

Usage
-----

[](#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
--------

[](#security)

Only `SELECT` queries are allowed. All destructive operations like `UPDATE`, `DELETE`, or `DROP` are blocked.

Customization
-------------

[](#customization)

To override the widget view:

1. Publish the views as shown above.
2. 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
-----------

[](#history-log)

Track and store all SQL generation activity using the built-in logging model (`SqlGenLog`).

Contributing
------------

[](#contributing)

Contributions are welcome! Please fork the repo, make changes, and open a pull request.

License
-------

[](#license)

This package is open-source and licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

38

—

LowBetter than 84% of packages

Maintenance54

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 62.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

17

Last Release

353d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f47cff8ce3f93868b40ac01d5b9a7f4d254434b55d6850cf064b6bbf868fdab7?d=identicon)[zeeshantariq08](/maintainers/zeeshantariq08)

---

Top Contributors

[![zeeshantariq08](https://avatars.githubusercontent.com/u/46603062?v=4)](https://github.com/zeeshantariq08 "zeeshantariq08 (5 commits)")[![carlosrgzm](https://avatars.githubusercontent.com/u/1535695?v=4)](https://github.com/carlosrgzm "carlosrgzm (3 commits)")

---

Tags

aifilamentGeminifilamentphpgoogle-aisqlgentext-to-sqlnatural-language-to-sql

### Embed Badge

![Health badge](/badges/zeeshantariq-filament-sqlgen/health.svg)

```
[![Health](https://phpackages.com/badges/zeeshantariq-filament-sqlgen/health.svg)](https://phpackages.com/packages/zeeshantariq-filament-sqlgen)
```

###  Alternatives

[maestroerror/laragent

Power of AI Agents in your Laravel project

630106.4k](/packages/maestroerror-laragent)[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

310107.9k1](/packages/cognesy-instructor-php)[symfony/ai-platform

PHP library for interacting with AI platform provider.

51927.7k134](/packages/symfony-ai-platform)[dotswan/filament-map-picker

Easily pick and retrieve geo-coordinates using a map-based interface in your Filament applications.

124139.3k2](/packages/dotswan-filament-map-picker)[tomatophp/filament-icons

Picker &amp; Table Column &amp; Icons Provider for FilamentPHP

3598.2k13](/packages/tomatophp-filament-icons)[asosick/filament-layout-manager

Allow users to create &amp; customize their own FilamentPHP pages composed of Livewire components

5718.8k2](/packages/asosick-filament-layout-manager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
