PHPackages                             mahmoud-mhamed/laravel-backup-station - 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. [Database &amp; ORM](/categories/database)
4. /
5. mahmoud-mhamed/laravel-backup-station

ActiveLibrary[Database &amp; ORM](/categories/database)

mahmoud-mhamed/laravel-backup-station
=====================================

Automatic database backup station for Laravel — schedule, retention, monthly keep-rules, rename and download backups from a beautiful dashboard.

v1.1.5(2w ago)0316↓71.5%MITPHPPHP ^8.0.2

Since May 6Pushed 2w agoCompare

[ Source](https://github.com/mahmoud-mhamed/laravel-backup-station)[ Packagist](https://packagist.org/packages/mahmoud-mhamed/laravel-backup-station)[ RSS](/packages/mahmoud-mhamed-laravel-backup-station/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (6)Versions (12)Used By (0)

Laravel Backup Station
======================

[](#laravel-backup-station)

Automatic database backups for Laravel — schedule, retention rules, monthly snapshots, rename, download, and a beautiful dashboard. Built in the same style as [`laravel-logman`](https://github.com/mahmoud-mhamed/laravel-logman).

Features
--------

[](#features)

- 📅 **Scheduled backups** — hourly / daily / weekly / monthly / custom cron, no scheduler boilerplate
- 🗂️ **Max copies retention** — hard cap on the number of backup files
- 🗓️ **Monthly keep rule** — keep one backup from a chosen day-of-month for N months
- ⏳ **Age-based pruning** — delete backups older than X days
- 📌 **Mark** important backups so retention never deletes them
- ↺ **Restore** any successful backup back into its database with one click
- ⚠ **Missing-file detection** — entries whose file no longer exists on the disk are flagged in the dashboard
- 🐬 **Multi-driver** — MySQL/MariaDB, PostgreSQL, SQLite
- 🗜️ **ZIP / Gzip / Plain** — backups default to `.sql.zip` (opens with any tool); switch to `.sql.gz` or plain `.sql` via `BACKUP_STATION_ARCHIVE`
- ⬇️ **Download** any backup with one click
- ✏️ **Rename** backups in place (extension preserved)
- 🔍 **Search &amp; filter** by filename, database, status
- 🌑 **Dark mode** with persistent preference
- 🔒 **Password protection** + authorize callback for the dashboard
- 📒 **JSON metadata** stored in `backups.json` next to the SQL files
- 🛠️ **Artisan commands** for manual run / cleanup / install
- 🔁 **Multi-connection** support — back up several DB connections in one run
- 📣 **Notifications** — Mail / Slack / Telegram / Discord / Log, with per-event routing
- 🚀 **Async by default** — Mail, Telegram, Discord deliver via the queue (`afterResponse`) so the dashboard never blocks

Installation
------------

[](#installation)

```
composer require mahmoud-mhamed/laravel-backup-station
php artisan backup-station:install
```

Open `/backup-station` in your browser.

Configuration
-------------

[](#configuration)

Edit `config/backup-station.php`:

```
'schedule' => [
    'enabled' => true,
    'frequency' => 'daily',          // hourly|daily|twiceDaily|monthly|cron
    'time' => '02:00',
    'days' => ['*'],                 // every day; or ['monday','wednesday','friday'], or [1,3,5]
    'day_of_month' => 1,             // used by frequency=monthly
    'cron' => '0 2 * * *',
],

'storage' => [
    'disk' => env('BACKUP_STATION_DISK'),     // null = filesystems.default; or 's3', 'minio', 'spaces'…
    'path' => env('BACKUP_STATION_PATH', 'backup-station'),
],

'notifications' => [
    'on_success' => ['enabled' => true, 'channels' => ['log']],
    'on_failure' => ['enabled' => true, 'channels' => ['log', 'mail']],

    'channels' => [
        'mail' => [
            // Either a literal array or a comma-separated env value.
            'to' => ['admin@example.com', 'devops@example.com'],
            // or: 'to' => env('BACKUP_STATION_MAIL_TO'),
            'from' => env('BACKUP_STATION_MAIL_FROM', env('MAIL_FROM_ADDRESS')),
            'mailer' => env('BACKUP_STATION_MAILER', env('MAIL_MAILER')),
            'queue' => true,    // async by default
        ],
        'slack' => [
            'webhook' => env('BACKUP_STATION_SLACK_WEBHOOK', env('LOG_SLACK_WEBHOOK_URL')),
            'queue' => false,   // webhook is fast; sync is fine
        ],
        'telegram' => [
            'bot_token' => env('BACKUP_STATION_TELEGRAM_BOT_TOKEN'),
            'chat_id' => env('BACKUP_STATION_TELEGRAM_CHAT_ID'),
            'queue' => true,    // async by default
        ],
        'discord' => [
            'webhook' => env('BACKUP_STATION_DISCORD_WEBHOOK'),
            'queue' => true,    // async by default
        ],
    ],
],

'retention' => [
    'max_backups' => 30,         // hard cap (0 = unlimited)
    'keep_for_days' => 14,       // delete older than (0 = forever)
    'monthly_keep' => [
        'enabled' => true,
        'day' => 1,              // keep the 1st of each month
        'keep_months' => 12,     // for 12 months
    ],
],
```

The package auto-registers its scheduler — just make sure Laravel's `schedule:run` is wired up (Laravel 11+ does this for you).

Artisan Commands
----------------

[](#artisan-commands)

```
php artisan backup-station:run                 # back up now
php artisan backup-station:run --connection=mysql --note="Pre-deploy"
php artisan backup-station:cleanup             # apply retention policy now
php artisan backup-station:install             # publish config
php artisan backup-station:install --force     # overwrite existing config
```

> Use `--force` when re-running install after a package upgrade if you want the published `config/backup-station.php` overwritten with the latest defaults. Without `--force`, your existing file is preserved.

Programmatic API
----------------

[](#programmatic-api)

```
use MahmoudMhamed\BackupStation\Facades\BackupStation;

BackupStation::runBackup();             // returns created entries
BackupStation::applyRetentionPolicy();  // returns deleted IDs
BackupStation::stats();                 // dashboard stats
```

Loading Indicator
-----------------

[](#loading-indicator)

Long-running operations (creating a backup, importing a backup file, running retention cleanup) display a full-screen spinner overlay while the request is in flight, so the user can see the action is in progress and won't double-submit.

Dashboard
---------

[](#dashboard)

The dashboard at `/backup-station` shows:

- Total / success / failed counts and disk usage
- Latest backup
- Full list with **Download**, **Rename**, **Pin**, **Delete** actions
- "Run Backup Now" and "Cleanup" buttons
- Search and per-page filtering
- Config viewer page
- About page with the full feature list

Security
--------

[](#security)

```
// config/backup-station.php
'viewer' => [
    'password' => env('BACKUP_STATION_PASSWORD'),
    'middleware' => ['web', 'auth'],
    'authorize' => fn ($req) => $req->user()?->isAdmin(),
],
```

When `authorize` is `null`, the dashboard is only reachable in `local` env.

License
-------

[](#license)

MIT

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance96

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity45

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 ~2 days

Total

11

Last Release

19d ago

PHP version history (2 changes)v1.0.0PHP ^8.1

v1.1.5PHP ^8.0.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d00c2f8ae29401e1b578e1435eae2629802a0c10e8322e5cb12d701538ff971?d=identicon)[mahmoud-mhamed](/maintainers/mahmoud-mhamed)

---

Top Contributors

[![mahmoud-mhamed](https://avatars.githubusercontent.com/u/45818696?v=4)](https://github.com/mahmoud-mhamed "mahmoud-mhamed (10 commits)")

---

Tags

laraveldatabasebackupmysqldumpscheduledashboardretention

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mahmoud-mhamed-laravel-backup-station/health.svg)

```
[![Health](https://phpackages.com/badges/mahmoud-mhamed-laravel-backup-station/health.svg)](https://phpackages.com/packages/mahmoud-mhamed-laravel-backup-station)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

88011.3M149](/packages/spatie-laravel-health)[illuminate/queue

The Illuminate Queue package.

20432.2M1.5k](/packages/illuminate-queue)[laravel/ai

The official AI SDK for Laravel.

9782.1M153](/packages/laravel-ai)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

436834.4k1](/packages/clickbar-laravel-magellan)[itpathsolutions/dbstan

Database Standardization and Analysis Tool for Laravel

442.1k](/packages/itpathsolutions-dbstan)

PHPackages © 2026

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