ifsnop/mysqldump-php
Pure-PHP mysqldump alternative with sane defaults and no external dependencies. Dumps schema, data, views, triggers, routines and events; supports blobs as hex, view dependency resolution, extended/complete inserts, insert-ignore, compression/streaming, hooks, and restore.
tenant_id).mysqldump calls in CI/CD pipelines (e.g., GitHub Actions, Deployer).Artisan::command() for CLI-driven backups.--single-transaction and chunking for safety..sql, .sql.gz) still require robust storage (S3, local paths) and cleanup logic (e.g., TTL-based deletion).--compatible=mysql55 if needed..env or vaults like HashiCorp Vault).--tables or --where clauses)?backup_contents table)?scheduled:run) or manual (e.g., php artisan db:backup)?mysql CLI)?mysqldump dispatched to database queue).Migrated event listener).pdo_mysql or mysql extension (enabled by default in Laravel).Phase 1: Proof of Concept
composer require ifsnop/mysqldump-php:^2.11.$mysqldump->startDump('backup.sql') with large datasets.mysqldump --no-data for schema-only backups.Phase 2: Laravel Integration
app/Services/BackupService.php) to wrap MySqlDumper with Laravel-specific logic (e.g., storage paths, error handling).BackupServiceProvider) to bind the service to the container.php artisan make:command DbBackupCommand) for CLI access.Phase 3: Automation
schedule:run (e.g., daily at 2 AM).- name: Backup DB
run: php artisan db:backup --storage=s3
--compatible=mysql55 flag)..sql for ETL pipelines (e.g., load into Redshift).ifsnop/mysqldump-php:^2.11 in composer.json to avoid regressions.scheduler or a BackupCleanupCommand.logs/backup.log for troubleshooting.php artisan db:backup --help).--single-transaction and chunking for >10GB dumps.| Failure Scenario | Mitigation |
|---|---|
| Backup corruption | Validate .sql files post-dump (e.g., mysql --force backup.sql). |
| Storage full | Set up S3 lifecycle policies or local disk quotas. |
| MySQL connection timeout | Implement retries with exponential backoff in the service class. |
| PHP memory limits | v2.11 mitigates this; increase memory_limit in php.ini if needed. |
| Credential leaks | Use Laravel’s .env or secrets manager; never hardcode credentials. |
BackupService class in the codebase.How can I help you explore Laravel packages today?