Releases: dgtlss/capsule
v2.1.0
v2.0.1
v2.0.0
🎉 Capsule v2.0.0 — Complete Rewrite
Capsule v2 is a ground-up rebuild that upgrades Capsule from a basic backup tool into a production-ready Laravel backup solution with enterprise-grade reliability, monitoring, and compliance.
💥 Breaking Changes (v1 → v2)
--vreplaced by--detailed- Config structure updated (new sections + some re-organisation)
- New migrations required
- Minimum PHP version is now 8.1+
- Filament provider consolidated into main provider
Migration
composer require dgtlss/capsulephp artisan vendor:publish --tag=capsule-config --force- Review/merge config changes
php artisan migrate- Update scripts using
--v→--detailed - Test in staging before production
🚀 Highlights
Incremental & Differential Backups
- Incremental mode: backs up only files changed since the last full backup
- Change detection via file size + modified time
- Automatic fallback to full backup when no baseline exists
- Typical strategy: weekly full + daily incremental
- Uses
BackupSnapshotto track file states between runs
Backup Simulation & Planning
- Dry-run to estimate size and duration before committing
- Estimates raw size, archive size, and duration from historical throughput
- Reports largest files + top extensions
- Compares against recent backups
- Warns about low disk space or unusually large datasets
Backup Policies as Code
- Define named policies (e.g.
database-hourly,full-weekly) - Per-policy configuration: schedule, retention, disk, includes/excludes
- Run policies manually:
php artisan capsule:backup --policy=database-hourly - Enables multi-tier backup strategies with independent schedules
Full Restore Capability
- New
capsule:restorecommand - Restore latest or by ID
- Database-only, files-only, or full restore
- Browse contents with
--list - Selective restore with
--only(glob patterns) - Restore to different target paths / DB connections
--dry-runand--forcesupported- Supports MySQL, PostgreSQL, SQLite
Envelope Encryption + Key Rotation
- Envelope encryption (DEK per backup, wrapped by a master key)
- Manifest stores Key ID enabling key rotation
- Old backups remain decryptable with their original keys
Anomaly Detection
- Flags unusual backups based on rolling averages:
- Size (>200% larger/smaller)
- Duration (>300% longer)
- File count shifts
- Compression efficiency drops
- Included in summary output and notifications
Database Dump Validation
- Validates dumps before archiving:
- MySQL/MariaDB: header + “Dump completed” marker
- PostgreSQL: header format
- SQLite: magic bytes + minimum size
- Prevents storing corrupt/incomplete dumps
Compliance Audit Log
- Immutable audit trail of backup operations (backup/restore/cleanup/verify)
- Stored in
backup_audit_logs - Useful for regulated environments (e.g. SOC2/HIPAA-style evidence)
S3 Lifecycle Management
- Automatic object tagging for S3-compatible storage
- Configurable storage class transitions (e.g. STANDARD → IA → GLACIER)
- Works with AWS S3, Spaces, MinIO, etc.
Continuous Integrity Monitoring
- Scheduled verification of archives:
- ZIP integrity + SHA-256 checksums
- Default re-check interval: 7 days
- Failures trigger notifications
- Runner command:
capsule:verify-scheduled
Metrics & Schedule Advisor
- New
capsule:advisorcommand:- Size growth trends, duration patterns, compression efficiency
- Failure rates and streaks
- Actionable schedule optimisation suggestions
Multi-Disk Backup Redundancy
- Replicate backups to
additional_disks - Replication failures are logged but do not fail the backup
- Great for geo redundancy / tiered storage
(Per-disk retention rules coming soon)
Interactive Backup Downloads
- New
capsule:downloadcommand - Download latest or by ID to a local path
- Progress output for large archives
Smart Backup Triggers
- New
capsule:backup-if-stalecommand - Runs only if last successful backup exceeds a staleness threshold (default 24h)
- Useful for deploy hooks or redundant schedules
🔧 Improvements & Fixes
Notification System Overhaul
- Richer notifications + better formatting
- Modern payloads:
- Slack Block Kit, Discord Embeds, Teams Adaptive Cards, Google Chat Card v2
- Channel filtering via
notify_on(e.g. failures only) - Webhook retries with exponential backoff
- Includes app/env/host, size, duration, disk, errors, anomaly warnings
Built-in File Filters
MaxFileSizeFilterExtensionFilter(allow/deny)PatternFilter(regex paths)- All implement
FileFilterInterface - Registered via
extensibility.file_filters
Better CLI Consistency
- Replaced
--vwith--detailed(avoids Symfony verbosity conflicts) - Added
--db-onlyand--files-only - All commands support
--format=jsonfor automation/CI
Critical Bug Fixes
- Retention cleanup: replaced aggressive
orWhereNotInwith safe logic - Lock lifecycle: ensured lock is always released (finally block)
- Path exclusions: fixed basename matching to avoid false positives
- PHP requirement aligned to 8.1+
- S3/FTP adapters moved to optional installs (suggested)
Shared Logic Extraction / Parity
- Extracted shared components:
DatabaseDumper,ManifestBuilder,Helpers
ChunkedBackupServicebrought to full parity with standard backups
🧪 Testing & Quality
- 40 tests covering backup, restore, cleanup, verification, scheduling
- Mock implementations for safe test runs
- CI-ready PHPUnit setup (
phpunit.xml) - Repo hygiene:
.gitignoreclean-up (removed vendor/, test-app/)
📦 Programmatic API
- New
Capsulefacade:Capsule::backup(array $options = [])Capsule::simulate()Capsule::list()Capsule::latest()Capsule::isHealthy()
📊 Database & Config Changes
New Migrations
- Add tag support (
backup_logs) backup_metricsbackup_snapshotsverification_logsbackup_audit_logs
New Config Sections
policies,chunked_backup,verification,anomaly,audits3_lifecycle,health,extensibility
🎨 New Commands
capsule:restorecapsule:downloadcapsule:advisorcapsule:backup-if-stalecapsule:verify-scheduled
v1.1.0
v1.0.4
v1.0.3
v1.0.2
v1.0.1
v1.0.0
Highlights
• Reliable backups with atomic flow and manifest checksums
• Chunked streaming mode (no local disk), concurrent uploads
• Preflight DB connectivity guard (backs out early and notifies if unreachable)
• Budget‑aware retention and improved cleanup
• JSON output for CI/automation across core commands
• Locking (single‑flight) to prevent overlapping runs
• Verify at rest, including best‑effort remote checksum on S3
• Events and extension points (file filters, pre/post steps)
• Health reporting and Filament browse/inspect panel (no restore)
• Styled HTML emails and richer webhook notifications
New and improved
• Integrity and manifest
• Every archive now contains manifest.json with metadata and per‑entry SHA‑256 checksums
• capsule:verify validates the ZIP and manifest; --all supported
• S3 best‑effort ETag check (single‑part uploads) for remote verification
• Chunked backups
• Stream database dumps and files directly to storage without local disk
• Concurrent chunk uploads with stats and fault tolerance
• JSON output
• capsule:backup --format=json
• capsule:cleanup --format=json
• capsule:verify --format=json and --all
• Retention and budget
• Age/count policies plus optional storage budget via retention.max_storage_mb
• Prunes oldest backups until usage is under budget, honoring retention.min_keep
• Locking
• Prevent overlapping runs with cache locks (configurable store, timeout, wait)
• --force to bypass in emergencies
• Reliability (uploads)
• Configurable retries and exponential backoff for storage operations
• Observability and health
• capsule:diagnose includes a health summary (last success age, recent failures, usage)
• capsule:health --format=json emits a snapshot for dashboards or checks
• Optional Spatie Laravel Health check provided
• Commands
• capsule:list [--limit] [--format]
• capsule:inspect {id} [--format] (reads manifest.json from the archive)
• capsule:verify {id?} [--all] [--format]
• capsule:cleanup [--days] [--dry-run] [--format]
• capsule:backup [--no-local] [--parallel] [--compress=] [--encrypt] [--verify] [--format]
• Hooks and extensibility
• Events at each stage: BackupStarting, DatabaseDumpStarting/Completed, FilesCollectStarting/Completed, ArchiveFinalizing, BackupUploaded, BackupSucceeded/Failed
• File filters via FileFilterInterface
• Pre/post steps via StepInterface (run before/after; failures abort)
• Notifications
• Styled HTML emails
• Clear preflight failure message (“Backup Failed – Database Unreachable”) with guidance
• Filament panel (browse only)
• Simple page to list backups, health stats, and inspect hints (no automatic restore)
Configuration additions
• Locking
• lock.store, lock.timeout_seconds, lock.wait_seconds
• Retention budget
• retention.max_storage_mb, retention.min_keep
• Storage retries
• storage.retries, storage.backoff_ms, storage.max_backoff_ms
• Health thresholds
• health.max_last_success_age_days, health.max_recent_failures, health.warn_storage_percent
• Extensibility
• extensibility.file_filters, extensibility.pre_steps, extensibility.post_steps