filaforge/filament-database-tools
最新稳定版本:v1.0.0
Composer 安装命令:
composer require filaforge/filament-database-tools
包简介
Combined database viewer and query builder for FilamentPHP - A comprehensive tool for database management
README 文档
README
A comprehensive Filament plugin that provides essential database management tools directly in your admin panel.
Features
- Database Backup: Create and manage database backups
- Schema Management: View and modify database structure
- Data Import/Export: Bulk data operations with multiple formats
- Query Optimization: Analyze and optimize database queries
- Table Management: Create, modify, and drop database tables
- Index Management: Manage database indexes for performance
- User Management: Database user and permission management
- Monitoring: Real-time database performance monitoring
- Migration Tools: Advanced migration management utilities
Installation
1. Install via Composer
composer require filaforge/database-tools
2. Publish & Migrate
# Publish provider groups (config, views, migrations) php artisan vendor:publish --provider="Filaforge\\DatabaseTools\\Providers\\DatabaseToolsServiceProvider" # Run migrations php artisan migrate
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\DatabaseTools\DatabaseToolsPlugin::make()); }
Setup
Configuration
The plugin will automatically:
- Publish configuration files to
config/database-tools.php - Publish view files to
resources/views/vendor/database-tools/ - Publish migration files to
database/migrations/ - Register necessary routes and middleware
Database Configuration
Configure database tools in the published config file:
// config/database-tools.php return [ 'backup' => [ 'enabled' => true, 'path' => storage_path('backups/database'), 'retention_days' => 30, ], 'import' => [ 'max_file_size' => '10MB', 'allowed_extensions' => ['csv', 'xlsx', 'json'], ], 'export' => [ 'chunk_size' => 1000, 'timeout' => 300, ], 'permissions' => [ 'admin_only' => true, 'allowed_roles' => ['admin', 'database_manager'], ], ];
Environment Variables
Add these to your .env file if needed:
DB_TOOLS_BACKUP_ENABLED=true DB_TOOLS_BACKUP_PATH=storage/backups/database DB_TOOLS_MAX_FILE_SIZE=10MB
Usage
Accessing Database Tools
- Navigate to your Filament admin panel
- Look for the "Database Tools" menu item
- Choose the tool you want to use
Database Backup
- Create Backup: Generate a new database backup
- Schedule Backups: Set up automatic backup schedules
- Download Backups: Download backup files locally
- Restore Backups: Restore from previous backups
- Manage Retention: Configure backup retention policies
Schema Management
- View Tables: Browse all database tables and their structure
- Modify Schema: Add, modify, or remove columns
- Create Tables: Build new tables with custom schemas
- Drop Tables: Safely remove unused tables
- View Relationships: Explore table relationships and foreign keys
Data Import/Export
- Import Data: Upload CSV, Excel, or JSON files
- Export Data: Download table data in various formats
- Bulk Operations: Perform operations on large datasets
- Data Validation: Validate imported data before insertion
- Error Handling: Manage import/export errors gracefully
Query Optimization
- Query Analysis: Analyze slow queries and bottlenecks
- Index Suggestions: Get recommendations for new indexes
- Performance Monitoring: Track query execution times
- Query History: Review and optimize previous queries
Troubleshooting
Common Issues
- Permission denied: Ensure the user has database management rights
- Backup failures: Check disk space and write permissions
- Import timeouts: Adjust chunk size and timeout settings
- Memory limits: Large operations may exceed PHP memory limits
Debug Steps
- Check the plugin configuration:
php artisan config:show database-tools
- Verify routes are registered:
php artisan route:list | grep database-tools
- Test database connectivity:
php artisan tinker
# Test database connection manually
- Check backup directory permissions:
ls -la storage/backups/database
- Clear caches:
php artisan optimize:clear
- Check logs for errors:
tail -f storage/logs/laravel.log
Performance Optimization
- Use smaller chunk sizes for large imports
- Schedule backups during low-traffic periods
- Monitor disk space for backup storage
- Use appropriate indexes for frequently queried columns
Security Considerations
Access Control
- Role-based permissions: Restrict access to authorized users only
- Database privileges: Use dedicated database users with limited permissions
- Audit logging: Track all database operations and changes
- Backup security: Secure backup files and access
Best Practices
- Never expose database tools to public users
- Regularly review and update user permissions
- Encrypt sensitive backup files
- Monitor and log all database changes
- Use read-only database users when possible
Uninstall
1. Remove Plugin Registration
Remove the plugin from your panel provider:
// remove ->plugin(\Filaforge\DatabaseTools\DatabaseToolsPlugin::make())
2. Roll Back Migrations (Optional)
php artisan migrate:rollback
# or roll back specific published files if needed
3. Remove Published Assets (Optional)
rm -f config/database-tools.php rm -rf resources/views/vendor/database-tools
4. Remove Package and Clear Caches
composer remove filaforge/database-tools php artisan optimize:clear
5. Clean Up Backups (Optional)
rm -rf storage/backups/database
Support
- Documentation: GitHub Repository
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Contributing
We welcome contributions! Please see our Contributing Guide for details.
License
This plugin is open-sourced software licensed under the MIT license.
Made with ❤️ by the Filaforge Team
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-19