Skip to content
CAI
Software that uses CAICheck a score

spatie/laravel-backup

70.1

Strong · 19 September 2026

5k

lines of production code

PHP

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is a comprehensive backup management library for Laravel applications that handles file and database archiving, storage, and cleanup. It provides configurable retention strategies, health monitoring for backup destinations, and robust notification delivery via email, Slack, Discord, and webhooks. The package supports extensive localization for system alerts and includes detailed event listeners and logging for operational visibility.

How it got here

2016–2017 — v10 architecture overhaul and internationalization

25 changes.

This period focused on a comprehensive v10 rewrite, restructuring the core backup logic into dedicated domain classes and a configuration-driven architecture. It introduced granular event handling, specific exception types, and new operational features like retry and timeout controls. The release also expanded global accessibility by adding localized notification translations for multiple languages.

2018–2020 — backup monitoring and localization

19 changes.

This period focused on expanding the backup system's monitoring capabilities by introducing health checks for destination reachability, backup age, and storage limits. It also significantly broadened internationalization support by adding localized notification messages for numerous languages, including Indonesian, Turkish, Hindi, and others. Concurrently, comprehensive test coverage was added for core backup components, commands, events, and the new notification channels.

2021–2026 — Configuration validation and localization expansion

18 changes.

This period focused on hardening the backup system through a structured, validated configuration system and refactoring retry logic into a dedicated trait. It also significantly expanded internationalization support by adding translation files for multiple languages and introduced a new Discord notification channel for backup alerts.

Features

Add Discord notification channel support

Users can now receive backup notifications via Discord webhooks. This change introduces a new DiscordChannel and DiscordMessage builder that allows configuring the notification's username, avatar URL, title, description, color (success/warning/error), fields, and footer before sending the payload to a configured Discord webhook URL.

src/Notifications/Channels/Discord · high confidence

Added Bengali translations for backup and notification system messages

Users can now see system notifications and backup status messages in Bengali. This change introduces a new language file for notifications, covering translations for backup success/failure, cleanup operations, health checks, and general exception details, ensuring the backup feature's feedback is accessible to Bengali-speaking users.

resources/lang/bn · high confidence

Added Bulgarian translations for backup and notification messages

Users can now see backup status and exception notifications in Bulgarian. This change introduces a new language file for the 'bg' locale, providing translations for system alerts related to backup operations (successful, failed, cleanup, health checks) and exception details.

resources/lang/bg · high confidence

Added Croatian translations for backup and notification system

Users can now see backup-related notifications and error messages in Croatian. This change introduces a new language file for the 'hr' locale, providing translations for system alerts regarding successful and failed backups, cleanup operations, and storage health status.

resources/lang/hr · high confidence

Added Czech translations for backup and notification system messages

Users can now see system notifications and backup status messages in Czech. This change introduces a new \resources/lang/cs/notifications.php\ file containing translations for backup operations (success, failure, cleanup), health checks (healthy/unhealthy backups), and exception details, ensuring that Czech-speaking users receive accurate feedback regarding application backups and storage status.

resources/lang/cs · high confidence

Added Danish translations for backup and notification system messages

Users can now see backup-related notifications and system messages in Danish. This change adds a new \notifications.php\ language file for the Danish locale, covering strings for backup success/failure, cleanup operations, health checks, and general application metadata.

resources/lang/da · high confidence

Added Dutch translations for backup notification messages

Users can now see backup-related system notifications (such as success, failure, cleanup, and health status alerts) in Dutch. This change adds the \resources/lang/nl/notifications.php\ file, providing localized strings for backup operations, including error messages, disk usage warnings, and status summaries.

resources/lang/nl · high confidence

Added English translations for backup system notifications

Users will now see localized English messages for backup-related events, including success, failure, cleanup, and health status notifications. The new \resources/lang/en/notifications.php\ file provides text for exception details, backup creation and removal outcomes, and storage usage warnings, ensuring clear communication when backup operations succeed, fail, or require attention.

resources/lang/en · high confidence

Added Finnish localization for backup notifications

Users can now receive system notifications in Finnish. This change introduces a new \resources/lang/fi/notifications.php\ file containing translations for backup-related alerts, including success, failure, cleanup, and health-check messages, ensuring that backup destination properties and status updates are displayed in the correct language for Finnish-speaking users.

resources/lang/fi · high confidence

Added French translations for backup notification emails

Users who have set French as their interface language will now receive properly localized notification emails regarding backup operations. This change introduces the \resources/lang/fr/notifications.php\ file, providing French translations for messages related to backup success, failure, cleanup, and health checks, including specific strings for application names, disk details, and backup dates.

resources/lang/fr · high confidence

Added German translations for backup and exception notifications

Users viewing the application in German will now see localized messages for backup operations (success, failure, cleanup, health checks) and exception reports. This new file provides the specific German text for notification subjects and bodies, ensuring that alerts regarding backup status and system errors are displayed in the user's language.

resources/lang/de · high confidence

Added Hebrew translations for backup and notification messages

Users can now see system notifications, including backup success/failure alerts and health check reports, in Hebrew. This change adds a new localization file for Hebrew (he) containing translations for application name, disk details, and backup status messages.

resources/lang/he · high confidence

Added Indonesian translations for backup notifications

Users who select Indonesian as their interface language will now see localized messages for backup operations, including success, failure, cleanup, and health status notifications.

resources/lang/id · high confidence

Added Italian translations for backup notifications

Users can now receive backup-related system notifications in Italian. This change introduces a new \notifications.php\ language file for the Italian locale, providing translations for messages regarding backup success, failure, cleanup operations, and health status checks.

resources/lang/it · high confidence

Added Kazakh translations for backup and notification system messages

Users can now see system notifications, including backup success/failure alerts, health checks, and error traces, in Kazakh. This change adds the \resources/lang/kk/notifications.php\ file, providing localized strings for the backup management module so that Kazakh-speaking users receive clear, native-language updates regarding application backups and storage status.

resources/lang/kk · high confidence

Added Norwegian translations for backup notifications

Users with Norwegian language settings will now see localized messages for backup operations, including notifications for successful backups, failed backups, cleanup results, and health checks. This change adds the \resources/lang/no/notifications.php\ file containing translations for backup-related alerts and status information.

resources/lang/no · high confidence

Added Persian translations for backup notification messages

Users who have set Persian (fa) as their interface language will now see localized text for backup-related system notifications. This change introduces a new language file containing translations for messages regarding successful and failed backups, cleanup operations, and health checks, ensuring that alerts about backup status, disk usage, and errors are displayed in Persian rather than defaulting to English or missing strings.

resources/lang/fa · high confidence

Added Polish translations for backup notification messages

Users who have set their interface language to Polish will now see localized text for backup-related system notifications. This change introduces a new translation file for the Polish locale that covers messages regarding successful and failed backup creation, cleanup operations, and health check alerts (including unreachable destinations, empty backups, outdated data, and storage limit warnings).

resources/lang/pl · high confidence

Added Portuguese and Chinese localization files for backup notifications

New translation files for backup-related notifications have been added for Brazilian Portuguese (pt\_BR), Simplified Chinese (zh\_CN), and Traditional Chinese (zh\_TW). These files provide localized strings for backup success, failure, cleanup, and health status messages, ensuring that users of these languages receive clear, native-language alerts regarding application backup operations.

_resources/lang/pt\_BR, resources/lang/zh\_CN, resources/lang/zh\TW · high confidence

Added Portuguese translations for backup and notification system

Users can now see backup-related notifications and system messages in Portuguese. This change introduces a new \notifications.php\ language file for the \pt\ locale, covering translations for backup success/failure alerts, cleanup status, health checks, and general application metadata.

resources/lang/pt · high confidence

Added Romanian translations for backup notifications

Users can now see backup-related system notifications (such as success, failure, cleanup, and health status messages) in Romanian. This change adds the \resources/lang/ro/notifications.php\ file, providing localized strings for backup operations and disk usage information.

resources/lang/ro · high confidence

Added Russian translations for backup and notification system messages

Users can now see localized Russian text for backup-related notifications, including success, failure, and health-check alerts. This new file provides the specific wording for backup operations (creation, cleanup, and status checks) and general application metadata (such as disk name and backup size), ensuring that Russian-speaking users receive clear, native-language feedback during backup workflows.

resources/lang/ru · high confidence

Added Slovak language support for notifications

Users can now receive system notifications in Slovak. This change introduces a new translation file for the 'sk' locale, providing localized strings for backup status alerts (success, failure, health checks), exception messages, and general application terminology.

resources/lang/sk · high confidence

Arabic translations for backup notification messages

Users who have Arabic as their interface language will now see localized text for backup-related system notifications, including alerts for successful backups, failed operations, cleanup status, and health checks.

resources/lang/ar · high confidence

Hindi translations added for backup and notification system

Users can now see backup-related notifications (success, failure, cleanup, health checks) and exception messages in Hindi. This new \resources/lang/hi/notifications.php\ file provides the localized strings for the application's backup monitoring and error reporting features.

resources/lang/hi · high confidence

Initial release of the backup configuration file

The repository now includes a comprehensive \config/backup.php\ file that defines the default settings for the backup system, replacing the previous placeholder. This configuration allows users to customize backup sources (including file inclusion/exclusion and symlink handling), database dump options (such as compression, timestamps, and filename bases), and destination settings (including storage disks, compression algorithms, and failure handling). It also sets defaults for archive encryption, temporary storage paths, and notification channels, providing a complete starting point for configuring the backup behavior.

config · high confidence

Introduces DefaultStrategy for time-based and storage-cap cleanup

A new DefaultStrategy is added to handle backup cleanup by maintaining retention periods for daily, weekly, monthly, and yearly backups while also enforcing a maximum storage size limit. This strategy ensures the newest backup is never deleted, groups remaining backups by their date format to keep one representative per period, and removes older backups once the total size exceeds the configured maximum megabytes.

src/Tasks/Cleanup/Strategies · high confidence

Introduction of new backup lifecycle events and encryption enums

This change introduces a set of new event classes in the \src/Events\ directory to expose specific moments in the backup process, including \BackupHasFailed\, \BackupManifestWasCreated\, \BackupWasSuccessful\, \BackupZipWasCreated\, \CleanupHasFailed\, \CleanupWasSuccessful\, \DumpingDatabase\, \HealthyBackupWasFound\, and \UnhealthyBackupWasFound\. These events allow users to hook into the backup and cleanup workflows to react to successes, failures, and intermediate states. Additionally, new enums \DumpFilenameBase\ and \Encryption\ are added to standardize filename generation logic and define supported encryption algorithms (None, Default, Aes128, Aes192, Aes256) for backup archives.

src/Events · high confidence

Japanese translations for backup notification messages

Users who have Japanese set as their locale will now see localized Japanese text in backup-related system notifications, including alerts for successful or failed backups, cleanup operations, and health status checks.

resources/lang/ja · high confidence

Korean localization for backup notification emails

Users who select Korean as their interface language will now receive backup-related system notifications (such as success, failure, and health check alerts) in Korean. This change adds the \resources/lang/ko/notifications.php\ file, which provides the translated text strings for the backup module's email alerts.

resources/lang/ko · high confidence

New health checks for backup reachability, age, and storage size

The backup monitor now includes three new health checks: IsReachable verifies that the backup destination is accessible, MaximumAgeInDays ensures the newest backup is not older than a configurable number of days (defaulting to 1), and MaximumStorageInMegabytes alerts if the backup disk usage exceeds a configurable limit (defaulting to 5000 MB). These checks provide users with immediate feedback on backup connectivity, freshness, and storage consumption.

src/Tasks/Monitor/HealthChecks · high confidence

New helper classes for file validation, formatting, and logging

This change introduces several new helper classes in the \src/Helpers\ directory to support backup operations. The \File\ class provides logic to validate whether a file is a zip archive by checking its extension and MIME type, with fallback handling for drivers that may throw exceptions. The \Format\ class adds utility methods for displaying human-readable file sizes, converting boolean states to emojis, and calculating the age of a date in days. Additionally, a \RightAlignedTableStyle\ class is added to customize console table output, and a \backupLogger\ helper function is introduced to retrieve the \BackupLogger\ instance from the container.

src/Helpers · high confidence

New notification classes for backup and cleanup events with Discord and webhook support

The notification system now includes dedicated classes for BackupHasFailed, BackupWasSuccessful, CleanupHasFailed, CleanupWasSuccessful, HealthyBackupWasFound, and UnhealthyBackupWasFound events. These notifications are delivered via Mail, Slack (with graceful fallback if the class is missing), Discord, and a new Webhook channel, ensuring users receive detailed failure traces, disk properties, and health check results across all configured channels.

src/Notifications/Notifications · high confidence

Spanish translations for backup and exception notifications

Users can now see Spanish-language notifications for backup operations (success, failure, cleanup) and exception handling. This new \resources/lang/es/notifications.php\ file provides localized messages for backup health status, disk usage limits, and error traces, ensuring Spanish-speaking users receive clear context for system alerts.

resources/lang/es · high confidence

Turkish language support for backup notifications

Added Turkish translations for backup-related system notifications, including messages for successful and failed backups, cleanup operations, and health checks. This enables users who prefer Turkish to receive clear, localized alerts regarding backup status, disk usage, and error conditions.

resources/lang/tr · high confidence

Behavioural changes

Deprecation of post-creation backup encryption listener

The EncryptBackupArchive listener is now deprecated and no longer registered. Encryption is applied by the Zip component while the archive is being built, rather than after creation. This listener remains in the codebase for reference but is marked as obsolete.

src/Listeners · high confidence

Introduce new CleanupJob and CleanupStrategy architecture

The backup cleanup process has been refactored to use a new \CleanupJob\ class that orchestrates the deletion of old backups across multiple destinations. This job iterates through configured \BackupDestination\ instances, applying a pluggable \CleanupStrategy\ to determine which backups to remove. The strategy pattern allows for flexible cleanup logic, with the strategy now able to access its specific \BackupDestination\ context. The job also handles error reporting by firing \CleanupHasFailed\ or \CleanupWasSuccessful\ events and logs storage usage before and after cleanup.

src/Tasks/Cleanup · high confidence

Introduces dedicated Backup, BackupCollection, and BackupDestination domain classes

The backup destination logic has been refactored into three new domain classes: \Backup\, \BackupCollection\, and \BackupDestination\. The \Backup\ class now encapsulates individual file metadata (date, size, existence) with caching to reduce filesystem calls, and handles stream reading and deletion. \BackupCollection\ manages the list of backups, filtering for zip files and sorting by date. \BackupDestination\ represents a storage location, handling disk connections, writing backups via streams, and retrieving the collection of backups. A new \BackupDestinationFactory\ creates these instances from configuration. This change improves robustness by handling connection errors gracefully and optimizing performance through caching.

src/BackupDestination · high confidence

Introduction of specific exception classes for backup operations

The library now includes a dedicated set of exception classes in the \src/Exceptions\ directory to provide more granular error handling for backup processes. New exceptions such as \BackupFailed\, \BackupVerificationFailed\, \CannotCreateDbDumper\, \InvalidBackupDestination\, \InvalidBackupFile\, \InvalidBackupJob\, \InvalidCommand\, \InvalidConfig\, \InvalidHealthCheck\, and \NotificationCouldNotBeSent\ have been added. These classes offer specific static factory methods to throw detailed, context-aware errors—for example, \BackupVerificationFailed\ now explicitly reports zip file issues like empty archives or file count mismatches, while \CannotCreateDbDumper\ lists supported database drivers when an unsupported one is requested. This change improves debugging by replacing generic exceptions with descriptive messages tailored to specific failure points in the backup and notification workflow.

src/Exceptions · high confidence

Migration to dedicated backup package with new notification channels and removed skeleton code

The library has replaced its generic skeleton scaffolding (SkeletonClass, SkeletonFacade, SkeletonServiceProvider) with a dedicated BackupServiceProvider that registers the backup commands and configures the application. This change introduces new notification capabilities by adding Discord and Webhook channels, allowing users to receive backup alerts via these platforms. Additionally, the service provider now registers a configurable BackupLogger and resolves the cleanup strategy from the container, while also binding a temporary directory instance for backup operations.

src · high confidence

New v10 backup command architecture with retry, timeout, and config override capabilities

The backup commands (run, clean, monitor, list) have been rewritten for v10 to support new operational features: the \backup:run\ command now accepts \--timeout\ to limit execution time, \--tries\ to enable automatic retry on failure, and \--config\ to load an alternate configuration file at runtime. The \backup:clean\ command also supports \--config\ and \--tries\. All commands now implement the \Isolatable\ interface for isolated execution and use a centralized \BaseCommand\ that integrates a \BackupLogger\ for consistent console output and handles signal awareness (e.g., SIGINT) to prevent issues on Windows. The \backup:monitor\ command now returns a non-zero exit code on failure, making it suitable for CI/CD health checks, while \backup:list\ provides improved output with right-aligned numbers and explicit highlighting of unhealthy backup destinations.

src/Commands · high confidence

Refactored backup monitoring with new health check architecture

The backup monitoring system has been restructured to use a new, more robust health check framework. This introduces dedicated classes for managing backup destination status (\BackupDestinationStatus\), creating status instances from configuration (\BackupDestinationStatusFactory\), and defining abstract health checks (\HealthCheck\). Users benefit from a clearer separation of concerns in how backup destinations are validated, with failures now encapsulated in a \HealthCheckFailure\ object that distinguishes between expected and unexpected errors. The new factory allows for more flexible configuration of health checks per monitored backup, supporting both simple class names and complex options arrays.

src/Tasks/Monitor · high confidence

Refactored backup task execution with new configuration-driven architecture

The backup task logic in src/Tasks/Backup has been restructured to use a new Config-based architecture. A new BackupJobFactory now constructs the BackupJob using explicit SourceFilesConfig and database connection settings, replacing previous implicit or boolean-based configuration patterns. The DbDumperFactory has been updated to robustly parse database connection configurations, including support for read/write connection merging, explicit port validation, and specific settings for MySQL (GTID, SSL, charset) and MongoDB (authentication database). File selection now utilizes a dedicated FileSelection class that handles glob patterns, symlink following, and unreadable directory handling via Symfony Finder. Additionally, the Zip class now supports configurable compression methods and levels, and properly handles file encryption when a password is set.

src/Tasks/Backup · high confidence

Refactored notification system with dedicated event handling and channel routing

The notification subsystem has been restructured to decouple event listening from notification logic. A new EventHandler class now subscribes to backup and cleanup events (such as BackupHasFailed or CleanupWasSuccessful) and maps them to specific notification classes, replacing the previous direct dispatching mechanism. A dedicated Notifiable class manages routing to configured channels (Mail, Slack, Discord, Webhook) by reading webhook URLs and email recipients from the config, while BaseNotification provides a standardized interface for generating backup destination details and application context. This change centralizes notification delivery and makes it easier to configure which channels receive which events.

src/Notifications · high confidence

Retry logic extracted to dedicated Retryable trait using Laravel 10 Sleep helper

The retry mechanism for backup and cleanup operations has been refactored into a new \Retryable\ trait. This change introduces support for configurable retry counts and delays, sourced from the application's configuration, and utilizes Laravel 10's \Sleep\ helper for handling delays, replacing previous internal sleep implementations.

src/Traits · high confidence

Structured, validated configuration system for backups and notifications

The package now uses a set of typed configuration value objects (BackupConfig, CleanupConfig, NotificationsConfig, etc.) that replace the previous flat array approach. This change introduces strict validation for critical settings: empty strings for archive passwords no longer silently enable encryption, email addresses are validated, and numeric constraints (like compression levels and retry counts) are enforced. Users benefit from safer defaults, clearer error messages when configuration is invalid, and the ability to disable encryption by explicitly setting null or false values.

src/Config · high confidence

Ukrainian translations for backup notification emails

Users who select Ukrainian as their interface language will now see localized text in system notifications related to backup operations. This change adds a new \notifications.php\ language file for Ukrainian (\resources/lang/uk\), providing translations for messages regarding successful and failed backups, cleanup processes, and health checks, ensuring these alerts are readable in Ukrainian.

resources/lang/uk · high confidence

Upgrade guide and tooling configuration for v10

The package now provides an UPGRADING.md file detailing breaking changes for the v10 release, including a new encryption config format ('none', 'aes128', etc.), event listeners receiving primitive properties instead of objects, and the replacement of the consoleOutput() helper with backupLogger(). Additionally, the repository has migrated its static analysis tooling from Scrutinizer and Travis CI to PHPStan (level 6) and Rector (PHP 8.1 sets), and updated the PHPUnit configuration to version 10.5 schema.

(repo-wide) · high confidence

Test coverage

1 commit adding/updating tests in tests/stubs-db; Added test coverage for backup commands; Added test stub files for file system operations; Added test support classes for cleanup, health checks, and notifications; Added tests for BackupCollection and Backup classes; Added tests for BackupLogger config handling and Data class serialization; Added tests for Discord embed size limits; Added tests for backup and health check events; Added tests for backup archive verification; Added tests for manual archive encryption; Added tests for notification timezone handling and channel configuration; Added unit tests for backup configuration merging and validation; Added unit tests for backup core components.

Dependencies

Upgrade to Laravel 12/13 and PHP 8.3 with modernized dependencies

The package now requires PHP 8.3 and supports Laravel 12.40 through 13.0, replacing older framework constraints. Key dependencies have been updated to their latest major versions, including spatie/db-dumper to v4, spatie/temporary-directory to v2.3, and spatie/laravel-signal-aware-command to v2.1, while also adding support for Symfony 7.3.6 and 8.0 components. The test suite has migrated from PHPUnit to Pest v4.1.5, and static analysis tools like Larastan v3.8 and Rector v2.2.8 are now included in the development dependencies.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 70.

Lenses

  • Code Health 98
  • Architecture 91
  • Maturity 67
  • Readiness 67
  • Security 68

Changes since last survey

  • 300 commits — 243 feature/other, 57 fixes

By area

  • (root) — 94 commits
  • .github/workflows — 29 commits
  • src/Config — 28 commits
  • src/Tasks — 26 commits
  • (repo) — 23 commits
  • config/backup.php — 16 commits
  • resources/lang — 12 commits
  • src/Notifications — 10 commits
  • src/Commands — 8 commits
  • docs/installation-and-setup.md — 6 commits
  • tests/Commands — 5 commits
  • tests/Config — 5 commits
  • src/BackupDestination — 4 commits
  • docs/advanced-usage — 3 commits
  • src/Exceptions — 3 commits
  • tests/DbDumperFactoryTest.php — 3 commits
  • tests/Notifications — 3 commits
  • docs/_index.md — 2 commits
  • docs/introduction.md — 2 commits
  • src/BackupServiceProvider.php — 2 commits

Notable commits

  • fix: Add PHP 8.4 support and fix remaining test failures
  • fix: Add PHP 8.5 support, fix coverage warnings, ensure Pest 4/PHPUnit 12
  • fix: Fix #1975: resolve cleanup strategy from the specified config (#1976)
  • fix: Fix CI: remove PHP 8.3 (requires ^8.4) and slack-notification-channel (no L13 support)
  • fix: Fix German translations in notifications.php (#1969)
  • fix: Fix German translations in notifications.php (#1969)
  • fix: Fix PHPStan error in File::mimeType() (#1977)
  • fix: Fix PHPStan errors
  • fix: Fix an empty-string archive password silently enabling encryption (#1984)
  • fix: Fix broken link in installation-and-setup.md
  • fix: Fix callMethodOnDumper treating false config values as no-argument calls (#1961)
  • fix: Fix custom notification classes causing "Undefined array key" error (#1968)
  • fix: Fix lang pt
  • fix: Fix notification dates to respect app timezone
  • fix: Fix phpstan message
  • fix: Fix styling
  • fix: Fix styling
  • fix: Fix styling
  • fix: Fix styling
  • fix: Fix styling
  • …and 280 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

spatie/laravel-backup was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 2b39b6b0fb98eefb95f1ef6b6311983396823c72 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.