PHPackages                             filaforge/filament-database-query - 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. [Database &amp; ORM](/categories/database)
4. /
5. filaforge/filament-database-query

ActiveLibrary[Database &amp; ORM](/categories/database)

filaforge/filament-database-query
=================================

Database query plugin: SQL query explorer

v1.0.0(9mo ago)064↓41.7%MITPHPPHP &gt;=8.1

Since Aug 19Pushed 9mo agoCompare

[ Source](https://github.com/filaforge/filament-database-query)[ Packagist](https://packagist.org/packages/filaforge/filament-database-query)[ Docs](https://github.com/filaforge/database-query)[ RSS](/packages/filaforge-filament-database-query/feed)WikiDiscussions master Synced 1mo ago

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

Filaforge Database Query
========================

[](#filaforge-database-query)

A powerful Filament plugin that provides a SQL query interface directly in your admin panel for database management and analysis.

Features
--------

[](#features)

- **SQL Query Interface**: Write and execute SQL queries directly in Filament
- **Query Builder**: Visual query builder for complex database operations
- **Result Export**: Export query results in multiple formats (CSV, JSON, Excel)
- **Query History**: Save and reuse frequently used queries
- **Schema Explorer**: Browse database structure and relationships
- **Query Validation**: Built-in SQL syntax checking and validation
- **Security**: Role-based access control for database operations
- **Performance Monitoring**: Track query execution times and performance

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

[](#installation)

### 1. Install via Composer

[](#1-install-via-composer)

```
composer require filaforge/database-query
```

### 2. Publish &amp; Migrate

[](#2-publish--migrate)

```
# Publish provider groups (config, views, migrations)
php artisan vendor:publish --provider="Filaforge\\DatabaseQuery\\Providers\\DatabaseQueryServiceProvider"

# Run migrations
php artisan migrate
```

### 3. Register Plugin

[](#3-register-plugin)

Add the plugin to your Filament panel provider:

```
use Filament\Panel;

public function panel(Panel $panel): Panel
{
    return $panel
        // ... other configuration
        ->plugin(\Filaforge\DatabaseQuery\DatabaseQueryPlugin::make());
}
```

Setup
-----

[](#setup)

### Configuration

[](#configuration)

The plugin will automatically:

- Publish configuration files to `config/database-query.php`
- Publish view files to `resources/views/vendor/database-query/`
- Publish migration files to `database/migrations/`
- Register necessary routes and middleware

### Database Configuration

[](#database-configuration)

Configure database access in the published config file:

```
// config/database-query.php
return [
    'allowed_databases' => ['mysql', 'pgsql', 'sqlite'],
    'max_query_time' => 300, // 5 minutes
    'max_results' => 10000,
    'allowed_operations' => ['SELECT', 'SHOW', 'DESCRIBE'],
    'admin_only' => false,
];
```

### Environment Variables

[](#environment-variables)

Add these to your `.env` file if needed:

```
DB_QUERY_ENABLED=true
DB_QUERY_MAX_TIME=300
DB_QUERY_MAX_ROWS=10000
```

Usage
-----

[](#usage)

### Accessing the Database Query Tool

[](#accessing-the-database-query-tool)

1. Navigate to your Filament admin panel
2. Look for the "Database Query" menu item
3. Start writing and executing SQL queries

### Writing Queries

[](#writing-queries)

1. **Select Database**: Choose the target database connection
2. **Write SQL**: Enter your SQL query in the editor
3. **Validate**: Check syntax before execution
4. **Execute**: Run the query and view results
5. **Export**: Download results in your preferred format

### Query Examples

[](#query-examples)

```
-- Basic SELECT query
SELECT * FROM users WHERE created_at >= '2024-01-01';

-- Complex JOIN query
SELECT u.name, p.title, c.body
FROM users u
JOIN posts p ON u.id = p.user_id
JOIN comments c ON p.id = c.post_id
WHERE u.active = 1;

-- Database schema exploration
SHOW TABLES;
DESCRIBE users;
```

### Advanced Features

[](#advanced-features)

- **Query Templates**: Save and reuse common queries
- **Parameter Binding**: Use prepared statements for security
- **Result Filtering**: Filter and sort query results
- **Query Optimization**: Get suggestions for improving query performance

Troubleshooting
---------------

[](#troubleshooting)

### Common Issues

[](#common-issues)

- **Permission denied**: Ensure the user has database access rights
- **Query timeout**: Check the max\_query\_time configuration
- **Memory limits**: Large result sets may exceed PHP memory limits
- **Connection issues**: Verify database connection settings

### Debug Steps

[](#debug-steps)

1. Check the plugin configuration:

```
php artisan config:show database-query
```

2. Verify routes are registered:

```
php artisan route:list | grep database-query
```

3. Test database connectivity:

```
php artisan tinker
# Test database connection manually
```

4. Clear caches:

```
php artisan optimize:clear
```

5. Check logs for errors:

```
tail -f storage/logs/laravel.log
```

### Performance Tips

[](#performance-tips)

- Use `LIMIT` clauses for large datasets
- Add proper indexes to frequently queried columns
- Avoid `SELECT *` in production queries
- Use prepared statements for repeated queries

Security Considerations
-----------------------

[](#security-considerations)

### Access Control

[](#access-control)

- **Role-based permissions**: Restrict access to authorized users only
- **Query validation**: Whitelist allowed SQL operations
- **Result limits**: Prevent excessive data exposure
- **Audit logging**: Track all database operations

### Best Practices

[](#best-practices)

- Never allow `DROP`, `DELETE`, or `UPDATE` operations without proper safeguards
- Use read-only database users when possible
- Implement query timeout limits
- Monitor and log all database activities

Uninstall
---------

[](#uninstall)

### 1. Remove Plugin Registration

[](#1-remove-plugin-registration)

Remove the plugin from your panel provider:

```
// remove ->plugin(\Filaforge\DatabaseQuery\DatabaseQueryPlugin::make())
```

### 2. Roll Back Migrations (Optional)

[](#2-roll-back-migrations-optional)

```
php artisan migrate:rollback
# or roll back specific published files if needed
```

### 3. Remove Published Assets (Optional)

[](#3-remove-published-assets-optional)

```
rm -f config/database-query.php
rm -rf resources/views/vendor/database-query
```

### 4. Remove Package and Clear Caches

[](#4-remove-package-and-clear-caches)

```
composer remove filaforge/database-query
php artisan optimize:clear
```

Support
-------

[](#support)

- **Documentation**: [GitHub Repository](https://github.com/filaforge/database-query)
- **Issues**: [GitHub Issues](https://github.com/filaforge/database-query/issues)
- **Discussions**: [GitHub Discussions](https://github.com/filaforge/database-query/discussions)

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

[](#contributing)

We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.

License
-------

[](#license)

This plugin is open-sourced software licensed under the [MIT license](LICENSE).

---

**Made with ❤️ by the Filaforge Team**

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance58

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

3

Last Release

272d ago

Major Versions

0.1.2 → v1.0.02025-08-19

### Community

Maintainers

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

---

Top Contributors

[![blhk0532](https://avatars.githubusercontent.com/u/221689993?v=4)](https://github.com/blhk0532 "blhk0532 (5 commits)")

---

Tags

laravelplatformfilament

### Embed Badge

![Health badge](/badges/filaforge-filament-database-query/health.svg)

```
[![Health](https://phpackages.com/badges/filaforge-filament-database-query/health.svg)](https://phpackages.com/packages/filaforge-filament-database-query)
```

###  Alternatives

[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[relaticle/custom-fields

User Defined Custom Fields for Laravel Filament

15828.6k](/packages/relaticle-custom-fields)[outerweb/settings

Application wide settings stored in your database

4899.2k5](/packages/outerweb-settings)[guava/filament-modal-relation-managers

Allows you to embed relation managers inside filament modals.

7565.0k4](/packages/guava-filament-modal-relation-managers)

PHPackages © 2026

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