PHPackages                             ubxty/spatie-laravel-backup-utils - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. ubxty/spatie-laravel-backup-utils

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

ubxty/spatie-laravel-backup-utils
=================================

Enhanced utilities and notifications for spatie/laravel-backup with comprehensive logging, S3 configuration, and statistical analysis

1.0.2(11mo ago)044MITPHPPHP ^8.1|^8.2|^8.3CI passing

Since Jun 10Pushed 11mo agoCompare

[ Source](https://github.com/ubxty/spatie-laravel-backup-utils)[ Packagist](https://packagist.org/packages/ubxty/spatie-laravel-backup-utils)[ RSS](/packages/ubxty-spatie-laravel-backup-utils/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (4)Used By (0)

UBXTY Spatie Laravel Backup Utils
=================================

[](#ubxty-spatie-laravel-backup-utils)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6e9c2d543beb88ec785e879c0d353465a4476d5511077cb5a991dcad450e1d33/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f75627874792f7370617469652d6c61726176656c2d6261636b75702d7574696c732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ubxty/spatie-laravel-backup-utils)[![Total Downloads](https://camo.githubusercontent.com/456cc983fe437577b59b3954b22240c394a14387ec28dbd16c9c4b228090a5b9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f75627874792f7370617469652d6c61726176656c2d6261636b75702d7574696c732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ubxty/spatie-laravel-backup-utils)

Enhanced utilities and notifications for [spatie/laravel-backup](https://github.com/spatie/laravel-backup) with comprehensive logging, S3 configuration, and statistical analysis.

🚀 Features
----------

[](#-features)

- **🔧 Unified Command Interface** - Single `backup:utils` command for all backup operations
- **📊 Advanced Analytics** - Comprehensive backup statistics and trend analysis
- **🔍 S3 Configuration &amp; Testing** - Interactive S3 setup with connection validation
- **📝 Enhanced Logging** - Structured backup event logging with metadata
- **🔔 Smart Notifications** - Auto-enhanced notification system with detailed context
- **⚙️ Auto-Configuration** - Automatic setup of logging, filesystem, and notifications
- **🧪 Testing Tools** - Built-in connection testing and validation utilities

📋 Requirements
--------------

[](#-requirements)

- PHP 8.1 or higher
- Laravel 10.0 or higher
- [spatie/laravel-backup](https://github.com/spatie/laravel-backup) 8.0 or higher

📦 Installation
--------------

[](#-installation)

Install the package via Composer:

```
composer require ubxty/spatie-laravel-backup-utils
```

The package will automatically register its service provider and commands.

### Quick Setup

[](#quick-setup)

Run the installation command for guided setup:

```
php artisan backup:utils install
```

This will:

- Publish configuration files
- Set up backup logging
- Configure S3 filesystem (if needed)
- Install spatie/laravel-backup (if not present)
- Guide you through S3 configuration

🎯 Usage
-------

[](#-usage)

### Unified Command Interface

[](#unified-command-interface)

Access all backup utilities through a single command:

```
# Interactive menu with numbered options
php artisan backup:utils

# Direct actions
php artisan backup:utils stats          # View backup statistics
php artisan backup:utils config-s3      # Configure S3 settings
php artisan backup:utils logs           # View and analyze logs
php artisan backup:utils test           # Test notification system
php artisan backup:utils run            # Run backup with enhanced logging
php artisan backup:utils monitor        # Monitor backup health
php artisan backup:utils install        # Setup and configuration
```

**Interactive Menu Features:**

- 🎯 **Numbered Options (1-9)** - Simply type a number to select an action
- 🔄 **Smart Navigation** - Return to menu after each action completes
- 📋 **System Status** - Real-time status check of backup components
- 💡 **Contextual Tips** - Random helpful tips displayed with each menu
- ✨ **Visual Feedback** - Beautiful execution boxes with timing information
- 🧹 **Clean Interface** - Screen clearing and consistent styling

The interactive menu displays:

```
╭─────────────────────────────────────────────────────────────╮
│               🔧 UBXTY Backup Utils Dashboard              │
│              Enhanced Laravel Backup Management            │
│                     by Ubxty v1.0.0                        │
╰─────────────────────────────────────────────────────────────╯

🎯 Available Actions:

  [1] 📊 Backup Statistics & Analytics
      View comprehensive backup statistics, trends, and performance metrics

  [2] 🔧 S3 Configuration & Testing
      Configure and test S3 backup settings interactively

  [3] 🚀 Run Backup
      Execute backup with enhanced logging and notifications

  [4] 🔍 Monitor Backup Health
      Check backup health and generate monitoring reports

  [5] 📋 List Backups
      Display all available backups with detailed information

  [6] 🧹 Clean Old Backups
      Remove old backups according to retention policies

  [7] 🧪 Test Notifications
      Test backup notification system and logging

  [8] 📜 View Backup Logs
      View and analyze backup notification logs

  [9] ⚙️ Install & Configure
      Set up backup utilities with guided configuration

  [0] 🚪 Exit

💡 Tip: Start with "Install & Configure" if this is your first time

👉 Please enter your choice (0-9) [1]:

```

### Backup Statistics &amp; Analytics

[](#backup-statistics--analytics)

View comprehensive backup statistics:

```
# Default view (last 30 days)
php artisan backup:stats

# Custom time period
php artisan backup:stats --days=7

# Different output formats
php artisan backup:stats --format=summary
php artisan backup:stats --format=json

# Export reports
php artisan backup:stats --export=json
php artisan backup:stats --export=csv
```

**Statistics Include:**

- Success/failure rates and trends
- Performance metrics (memory usage, execution time)
- Notification type breakdown
- Recent activity timeline
- Failure analysis with troubleshooting suggestions

### S3 Configuration &amp; Testing

[](#s3-configuration--testing)

Interactive S3 backup configuration:

```
php artisan backup:config
```

**Features:**

- 🔍 Show current configuration with masked sensitive values
- ✏️ Interactive prompts for all S3 settings
- 🧪 Comprehensive connection testing
- 🛠️ Troubleshooting suggestions
- 🔄 Smart workflows (configure → test)

**Connection Testing:**

- S3 disk connectivity
- File upload/download operations
- Directory access validation
- Optional backup run test

### Backup Log Analysis

[](#backup-log-analysis)

View and analyze backup logs with detailed filtering:

```
# View recent backup logs (default: last 7 days)
php artisan backup:logs

# Filter by time period
php artisan backup:logs --days=30

# Filter by log level
php artisan backup:logs --level=error

# Show only statistics
php artisan backup:logs --stats

# Filter by backup event type
php artisan backup:logs --event=BackupWasSuccessful

# Limit number of entries
php artisan backup:logs --tail=100
```

**Log Analysis Features:**

- 📜 Automatic log file detection (daily rotation support)
- 🔍 Advanced filtering by level, event type, and time period
- 📊 Statistical analysis of backup events
- 📋 Formatted table output with color-coded log levels
- 🕐 Human-readable timestamps and event summaries

⚙️ Configuration
----------------

[](#️-configuration)

### Environment Variables

[](#environment-variables)

The package uses these environment variables:

```
# S3 Backup Configuration (Required)
AWS_ACCESS_KEY_ID_BACKUP=your_access_key
AWS_SECRET_ACCESS_KEY_BACKUP=your_secret_key
AWS_DEFAULT_REGION_BACKUP=us-east-1
AWS_BUCKET_BACKUP=your_bucket_name

# Optional S3 Settings
AWS_URL_BACKUP=https://your-bucket.s3.region.amazonaws.com
AWS_ENDPOINT_BACKUP=https://s3.region.amazonaws.com
AWS_USE_PATH_STYLE_ENDPOINT_BACKUP=false

# Backup Archive Encryption
BACKUP_ARCHIVE_PASSWORD=your_secure_password

# UBXTY Backup Utils Settings
BACKUP_LOG_LEVEL=debug
BACKUP_LOG_DAYS=60
BACKUP_STATS_DEFAULT_DAYS=30
```

### Auto-Configuration

[](#auto-configuration)

The package automatically configures:

1. **Backup Logging Channel** - Creates `backup` log channel
2. **S3 Filesystem Disk** - Sets up `s3_backup` disk
3. **Enhanced Notifications** - Adds logging to all backup notifications
4. **Backup Notifiable** - Uses enhanced notifiable class

To disable auto-configuration:

```
BACKUP_UTILS_AUTO_LOGGING=false
BACKUP_UTILS_AUTO_FILESYSTEM=false
BACKUP_UTILS_AUTO_NOTIFICATIONS=false
```

### Manual Configuration

[](#manual-configuration)

Publish configuration files for manual setup:

```
# Publish main config
php artisan vendor:publish --tag=backup-utils-config

# Publish environment template
php artisan vendor:publish --tag=backup-utils-env
```

🔐 Backup Encryption
-------------------

[](#-backup-encryption)

The package supports password-based encryption for backup archives:

### Setting Up Encryption

[](#setting-up-encryption)

1. **Environment Variable Method** (Recommended):

```
BACKUP_ARCHIVE_PASSWORD=your_secure_password_here
```

2. **Interactive Configuration**:

```
php artisan backup:config
# Select "Update S3 configuration" and set the archive password
```

3. **Direct Configuration**:

```
// config/backup.php
'backup' => [
    'destination' => [
        'password' => env('BACKUP_ARCHIVE_PASSWORD'),
        'encryption' => 'default', // Uses AES-256 when available
    ],
],
```

### Encryption Features

[](#encryption-features)

- **AES-256 Encryption**: Uses strong encryption when available on your system
- **Password Protection**: All backup archives are encrypted with your password
- **Secure Input**: Password is entered securely (hidden input) during configuration
- **Optional**: Encryption can be disabled by leaving password empty
- **Cross-Platform**: Works with standard ZIP encryption

### Security Best Practices

[](#security-best-practices)

- Use a strong, unique password for backup encryption
- Store the password securely (e.g., password manager)
- Consider rotating encryption passwords periodically
- Test backup restoration with encrypted archives
- Keep password separate from backup storage location

### Testing Encrypted Backups

[](#testing-encrypted-backups)

```
# Test backup creation with encryption
php artisan backup:run

# Verify encrypted backup can be accessed
php artisan backup:list

# Test S3 upload of encrypted backups
php artisan backup:config
# Choose "Update configuration and then test"
```

📝 Enhanced Logging
------------------

[](#-enhanced-logging)

The package provides structured logging for all backup events:

```
{
  "timestamp": "2024-01-15T10:30:00.000000Z",
  "notification_type": "BackupWasSuccessfulNotification",
  "notifiable_type": "BackupNotifiable",
  "metadata": {
    "memory_usage": 67108864,
    "php_version": "8.2.0",
    "laravel_version": "12.0"
  },
  "backup_info": {
    "backup_name": "laravel-backup",
    "disk_names": ["local", "s3_backup"],
    "file_size": 52428800,
    "backup_date": "2024-01-15T10:30:00.000000Z"
  }
}
```

Logs are automatically written to `storage/logs/backup.log` with daily rotation.

🔔 Enhanced Notifications
------------------------

[](#-enhanced-notifications)

The package enhances all Spatie backup notifications with:

- **Structured logging** of notification events
- **Metadata extraction** (memory usage, system info)
- **Backup information** (file sizes, disk names, dates)
- **Exception details** for failed operations
- **Performance metrics** for monitoring

📊 Statistics Dashboard
----------------------

[](#-statistics-dashboard)

The `backup:stats` command provides comprehensive analytics:

### Overview Metrics

[](#overview-metrics)

- Total backup events
- Success/failure rates
- Performance trends

### Detailed Analysis

[](#detailed-analysis)

- Notification type breakdown
- Time-based patterns (daily/hourly)
- Failure analysis with trends
- Recent activity timeline

### Export Options

[](#export-options)

- JSON format for APIs
- CSV format for spreadsheets
- Timestamped files for history

🧪 Testing
---------

[](#-testing)

The package includes comprehensive testing utilities:

### S3 Connection Testing

[](#s3-connection-testing)

```
php artisan backup:config
# Choose "Test existing S3 connection"
```

### Notification Testing

[](#notification-testing)

```
php artisan backup:test-notifications --type=success
php artisan backup:test-notifications --type=failed
```

🔧 Advanced Usage
----------------

[](#-advanced-usage)

### Custom Notifiable Class

[](#custom-notifiable-class)

To use a custom notifiable class:

```
// config/backup-utils.php
'notifications' => [
    'notifiable_class' => App\Notifications\CustomBackupNotifiable::class,
],
```

### Custom Log Channel

[](#custom-log-channel)

Configure a custom backup log channel:

```
// config/logging.php
'channels' => [
    'backup' => [
        'driver' => 'daily',
        'path' => storage_path('logs/backup.log'),
        'level' => 'debug',
        'days' => 60,
    ],
],
```

### Statistics Caching

[](#statistics-caching)

Configure statistics caching:

```
BACKUP_STATS_CACHE_DURATION=300  # 5 minutes
```

🛠️ Troubleshooting
------------------

[](#️-troubleshooting)

### Common Issues

[](#common-issues)

**S3 Connection Failures:**

- Verify AWS credentials are correct
- Check bucket exists and region matches
- Ensure proper S3 permissions
- Validate bucket naming conventions

**Missing Logs:**

- Check `storage/logs/` directory permissions
- Verify backup log channel configuration
- Ensure notifications are properly configured

**Command Not Found:**

- Clear configuration cache: `php artisan config:clear`
- Verify package is properly installed
- Check service provider registration

### Debug Mode

[](#debug-mode)

Enable verbose output for troubleshooting:

```
php artisan backup:utils stats -vvv
php artisan backup:config -vvv
```

📄 License
---------

[](#-license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

🤝 Contributing
--------------

[](#-contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

🔒 Security
----------

[](#-security)

If you discover any security related issues, please email  instead of using the issue tracker.

📞 Support
---------

[](#-support)

- 📧 Email:
- 🐛 Issues: [GitHub Issues](https://github.com/ubxty/spatie-laravel-backup-utils/issues)
- 📖 Documentation: [GitHub Wiki](https://github.com/ubxty/spatie-laravel-backup-utils/wiki)
- 🌐 Website: [UBXTY Unboxing Technology](https://ubxty.com)

---

**Built with ❤️ by [Ravdeep Singh](https://www.linkedin.com/in/ravdeep-singh-a4544abb/) • [UBXTY Unboxing Technology](https://ubxty.com)**

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance52

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

336d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e2de529037b10593205d6c41aa1d5331ef027e398489b74355b6d222ac10f2f1?d=identicon)[ubxty](/maintainers/ubxty)

---

Top Contributors

[![ravdeepsingh22](https://avatars.githubusercontent.com/u/13014642?v=4)](https://github.com/ravdeepsingh22 "ravdeepsingh22 (25 commits)")

---

Tags

spatielaravelloggings3backupnotificationsstatistics

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ubxty-spatie-laravel-backup-utils/health.svg)

```
[![Health](https://phpackages.com/badges/ubxty-spatie-laravel-backup-utils/health.svg)](https://phpackages.com/packages/ubxty-spatie-laravel-backup-utils)
```

###  Alternatives

[spatie/laravel-backup

A Laravel package to backup your application

6.0k21.8M191](/packages/spatie-laravel-backup)[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[shaffe/laravel-mail-log-channel

A package to support logging via email in Laravel

1286.2k](/packages/shaffe-laravel-mail-log-channel)[melihovv/laravel-log-viewer

A Laravel log viewer

1231.5k1](/packages/melihovv-laravel-log-viewer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
