PHPackages                             arham-solcoders/backupguard - 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. arham-solcoders/backupguard

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

arham-solcoders/backupguard
===========================

Laravel package that creates daily SQL database backups and keeps only the last 3 days using the scheduler.

v1.0.0(1mo ago)13↓88.9%MITPHPPHP ^8.1

Since Jun 2Pushed 1mo agoCompare

[ Source](https://github.com/arham-solcoders/backupguard)[ Packagist](https://packagist.org/packages/arham-solcoders/backupguard)[ Docs](https://github.com/arham-solcoders/backupguard)[ RSS](/packages/arham-solcoders-backupguard/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

Laravel DB Backup Package
=========================

[](#laravel-db-backup-package)

A publishable Laravel package that creates daily SQL database backups from the host project's database configuration and keeps only the last 3 days of backup files.

Features
--------

[](#features)

- Daily backup command: `db-backup:run`
- Reads connection settings from host app `config/database.php` (which comes from host `.env`)
- Supports MySQL/MariaDB and PostgreSQL
- Prunes backup files older than configured retention (default: 3 days)
- Publishable config file

Requirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 10/11/12
- System binaries:
    - `mysqldump` for MySQL/MariaDB
    - `pg_dump` for PostgreSQL

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

[](#installation)

```
composer require arham-solcoders/backupguard
```

The service provider is auto-discovered.

Publish Config
--------------

[](#publish-config)

```
php artisan vendor:publish --tag=laravel-db-backup-config
```

This creates:

- `config/laravel-db-backup.php`

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

[](#configuration)

```
return [
    'enabled' => true,
    'backup_path' => storage_path('app/db-backups'),
    'connections' => [], // empty = auto-detect all supported SQL connections
    'retention_days' => 3,
    'compress' => false,
    'timeout_seconds' => 300,
];
```

Scheduling
----------

[](#scheduling)

For Laravel 11+, the package uses `withSchedule()` automatically.

For Laravel 10, add this to your app scheduler:

```
protected function schedule(Schedule $schedule): void
{
    $schedule->command('db-backup:run')->daily();
}
```

Cron (Server)
-------------

[](#cron-server)

Make sure your server cron runs Laravel scheduler every minute:

```
* * * * * php /path-to-project/artisan schedule:run >> /dev/null 2>&1
```

Verify
------

[](#verify)

Run manually:

```
php artisan db-backup:run
```

Backups are stored in:

- `storage/app/db-backups/{connection-name}/{YYYY-MM-DD}/`

Publish This Package (Complete Steps)
-------------------------------------

[](#publish-this-package-complete-steps)

1. Create a new GitHub repository for this package.
2. Push code to `main`.
3. Tag a release: ```
    git tag v1.0.0
    git push origin v1.0.0
    ```
4. Publish to Packagist:
    - Open
    - Submit your repository URL
5. In consumer Laravel app:
    - `composer require arham-solcoders/backupguard`
    - `php artisan vendor:publish --tag=laravel-db-backup-config`
    - Configure backup path/connections
    - Ensure scheduler cron exists

Troubleshooting
---------------

[](#troubleshooting)

- `mysqldump: not found` or `pg_dump: not found`:
    - Install database client tools and ensure they are available in PATH.
- Authentication failures:
    - Verify host app `.env` DB credentials.
- Empty output:
    - Try command manually with verbose DB credentials to confirm binary access.

License
-------

[](#license)

MIT

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance90

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

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

Unknown

Total

1

Last Release

52d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/083d40f1688f31fbb72befe8088399c0d5493182c6e59572640b675b75c84473?d=identicon)[Arham khan](/maintainers/Arham%20khan)

---

Top Contributors

[![arham-solcoders](https://avatars.githubusercontent.com/u/255827132?v=4)](https://github.com/arham-solcoders "arham-solcoders (2 commits)")

---

Tags

schedulerlaraveldatabasebackupmysqlpostgresqlmysqldumpcronretention

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/arham-solcoders-backupguard/health.svg)

```
[![Health](https://phpackages.com/badges/arham-solcoders-backupguard/health.svg)](https://phpackages.com/packages/arham-solcoders-backupguard)
```

###  Alternatives

[illuminate/database

The Illuminate Database package.

2.8k54.9M12.2k](/packages/illuminate-database)[ramadan/custom-fresh

A Laravel package to specify the tables that you do not want to drop while refreshing the database.

611.6k](/packages/ramadan-custom-fresh)[moharrum/laravel-adminer

Adminer database management tool for your Laravel application.

451.0k](/packages/moharrum-laravel-adminer)[ramadan/easy-model

A Laravel package for enjoyably managing database queries.

111.6k](/packages/ramadan-easy-model)

PHPackages © 2026

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