https://github.com/filaforge/filament-database-viewer
Filament plugin for database viewing and exploration
https://github.com/filaforge/filament-database-viewer
Last synced: 6 months ago
JSON representation
Filament plugin for database viewing and exploration
- Host: GitHub
- URL: https://github.com/filaforge/filament-database-viewer
- Owner: filaforge
- License: mit
- Created: 2025-08-19T19:07:18.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2025-08-19T23:31:53.000Z (11 months ago)
- Last Synced: 2025-09-23T15:54:56.676Z (10 months ago)
- Language: PHP
- Size: 235 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Filaforge Database Viewer
A powerful Filament plugin that provides a comprehensive database viewing and exploration interface directly in your admin panel.
## Features
- **Table Browser**: Navigate through all database tables and views
- **Data Viewer**: View table contents with pagination and sorting
- **Schema Explorer**: Examine table structure, columns, and relationships
- **Search & Filter**: Find specific data with advanced filtering options
- **Export Capabilities**: Download table data in multiple formats
- **Relationship Mapping**: Visualize table relationships and foreign keys
- **Query Builder**: Simple query interface for data exploration
- **Performance Monitoring**: Track query execution times
- **Multi-Database Support**: Work with multiple database connections
## Installation
### 1. Install via Composer
```bash
composer require filaforge/database-viewer
```
### 2. Publish & Migrate
```bash
# Publish provider groups (config, views, migrations)
php artisan vendor:publish --provider="Filaforge\\DatabaseViewer\\Providers\\DatabaseViewerServiceProvider"
# Run migrations
php artisan migrate
```
### 3. Register Plugin
Add the plugin to your Filament panel provider:
```php
use Filament\Panel;
public function panel(Panel $panel): Panel
{
return $panel
// ... other configuration
->plugin(\Filaforge\DatabaseViewer\DatabaseViewerPlugin::make());
}
```
## Setup
### Configuration
The plugin will automatically:
- Publish configuration files to `config/database-viewer.php`
- Publish view files to `resources/views/vendor/database-viewer/`
- Publish migration files to `database/migrations/`
- Register necessary routes and middleware
### Database Configuration
Configure the viewer in the published config file:
```php
// config/database-viewer.php
return [
'connections' => ['mysql', 'pgsql', 'sqlite'],
'max_rows_per_page' => 100,
'enable_search' => true,
'enable_export' => true,
'allowed_operations' => ['SELECT', 'SHOW', 'DESCRIBE'],
'cache_results' => true,
'cache_ttl' => 300, // 5 minutes
];
```
### Environment Variables
Add these to your `.env` file if needed:
```env
DB_VIEWER_ENABLED=true
DB_VIEWER_MAX_ROWS=100
DB_VIEWER_CACHE_TTL=300
```
## Usage
### Accessing the Database Viewer
1. Navigate to your Filament admin panel
2. Look for the "Database Viewer" menu item
3. Start exploring your database structure
### Browsing Tables
1. **Select Connection**: Choose the database connection to explore
2. **Browse Tables**: View all available tables and views
3. **View Structure**: Examine table columns, types, and constraints
4. **Explore Data**: Browse table contents with pagination
5. **Search Data**: Use search and filter options to find specific records
### Data Exploration
1. **Table Navigation**: Switch between different tables
2. **Column Information**: View column details, types, and constraints
3. **Data Sorting**: Sort data by any column
4. **Pagination**: Navigate through large datasets
5. **Export Data**: Download table data in CSV, JSON, or Excel format
### Advanced Features
- **Relationship View**: See foreign key relationships between tables
- **Query Builder**: Build simple queries to explore data
- **Schema Export**: Export table schemas for documentation
- **Performance Stats**: Monitor query performance and execution times
## Troubleshooting
### Common Issues
- **Permission denied**: Ensure the user has database read access
- **Slow performance**: Check pagination settings and enable caching
- **Missing tables**: Verify database connection and user permissions
- **Memory issues**: Reduce max_rows_per_page setting
### Debug Steps
1. Check the plugin configuration:
```bash
php artisan config:show database-viewer
```
2. Verify routes are registered:
```bash
php artisan route:list | grep database-viewer
```
3. Test database connectivity:
```bash
php artisan tinker
# Test database connection manually
```
4. Check database permissions:
```bash
# Verify the database user has SELECT privileges
```
5. Clear caches:
```bash
php artisan optimize:clear
```
6. Check logs for errors:
```bash
tail -f storage/logs/laravel.log
```
### Performance Optimization
- Enable result caching in configuration
- Use appropriate pagination limits
- Optimize database indexes for frequently viewed columns
- Consider read-only database connections for viewing
## Security Considerations
### Access Control
- **Role-based permissions**: Restrict access to authorized users only
- **Read-only access**: Use database users with SELECT privileges only
- **Connection isolation**: Separate viewing connections from application connections
- **Audit logging**: Track all database viewing activities
### Best Practices
- Never expose database viewer to public users
- Use dedicated database users with minimal permissions
- Regularly review and update access controls
- Monitor and log all database access
- Implement query timeouts to prevent long-running queries
## Uninstall
### 1. Remove Plugin Registration
Remove the plugin from your panel provider:
```php
// remove ->plugin(\Filaforge\DatabaseViewer\DatabaseViewerPlugin::make())
```
### 2. Roll Back Migrations (Optional)
```bash
php artisan migrate:rollback
# or roll back specific published files if needed
```
### 3. Remove Published Assets (Optional)
```bash
rm -f config/database-viewer.php
rm -rf resources/views/vendor/database-viewer
```
### 4. Remove Package and Clear Caches
```bash
composer remove filaforge/database-viewer
php artisan optimize:clear
```
## Support
- **Documentation**: [GitHub Repository](https://github.com/filaforge/database-viewer)
- **Issues**: [GitHub Issues](https://github.com/filaforge/database-viewer/issues)
- **Discussions**: [GitHub Discussions](https://github.com/filaforge/database-viewer/discussions)
## Contributing
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
## License
This plugin is open-sourced software licensed under the [MIT license](LICENSE).
---
**Made with ❤️ by the Filaforge Team**