componist / backup
CLI and scheduled MySQL database backups for Laravel with PDO dump, ZIP archives, rotation, and optional email notify
Requires
- php: ^8.2
Requires (Dev)
- larastan/larastan: ^3.9
- phpstan/phpstan: ^2.1
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-17 11:24:05 UTC
README
Laravel-Package für den CLI-/Scheduler-Auto-Dump von MySQL: Artisan-Command, optionaler Queue-Job, ZIP-Archiv und Rotation alter Backups. Ergänzt das Dashboard-Package reinholdjesse/backup (UI + Admin-Gate).
Installation
Im Monorepo bereits registriert (Componist\Backup\BackupServiceProvider).
php artisan vendor:publish --tag=componist.backup
Konfiguration
Config-Key: componist_backup (config/componist_backup.php).
Key / .env |
Beschreibung |
|---|---|
path |
Backup-Verzeichnis (Standard: storage/backups) |
max_backups |
Anzahl behaltener ZIP-Dateien (Standard: 7) |
DB_* |
MySQL-Zugangsdaten (Fallback: database.connections.mysql) |
BACKUP_NOTIFY_EMAIL |
E-Mail bei Erfolg/Fehler |
BACKUP_DAILY_AT |
Scheduler-Zeit (Standard: 01:00) |
Nutzung
# In Queue stellen (Standard) php artisan componist:db-backup # Synchron ausführen (Cron ohne Worker) php artisan componist:db-backup --sync
Der Package-Scheduler führt täglich componist:db-backup --sync zur konfigurierten Zeit aus.
Commands
| Command | Beschreibung |
|---|---|
php artisan componist:db-backup |
Dump starten (Queue-Job) |
php artisan componist:db-backup --sync |
Dump synchron ausführen |
Berechtigungen
Kein HTTP-/Admin-Gate — Ausführung nur per CLI/Cron. Dashboard-Zugriff und Admin-Gate liegen in reinholdjesse/backup.
Tests
php artisan test --compact --testsuite="Componist Backup CLI"
Hinweise
- PDO-Dump — keine Shell-Interpolation / kein
mysqldumpviapassthru - Identifier-Guard — Tabellen-/Spaltennamen validiert und gequotet
- Path-Jail — nur unter konfiguriertem Root, Dateinamen
backup_YYYY-MM-DD_HH-mm-ss.zip - Erfolgs-Mail nur wenn
BACKUP_NOTIFY_EMAILgesetzt und gültig