PHPackages                             programinglive/laravel-simple-backup - 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. programinglive/laravel-simple-backup

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

programinglive/laravel-simple-backup
====================================

A simple Laravel package for backing up MySQL and PostgreSQL databases

v0.0.3(5mo ago)014MITPHPPHP ^8.1

Since Dec 8Pushed 5mo agoCompare

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

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

Laravel Simple Backup
=====================

[](#laravel-simple-backup)

[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)[![PHP Version](https://camo.githubusercontent.com/04744bae0a61d2ffe29c26f07a9612eae20445fc6feaeb77b3af1f0e9be6447c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e312d3838393242462e737667)](https://php.net/)[![Laravel Version](https://camo.githubusercontent.com/3029720d95207ba1c4973eb0c800378fdd7ef7d08c98da9430ceb7ab385bdd0e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d253345253344392e302d4646324432302e737667)](https://laravel.com/)

A simple Laravel package for backing up MySQL and PostgreSQL databases.

**Author:** Mahatma Mahardhika

Features
--------

[](#features)

- 🗄️ Support for MySQL and PostgreSQL databases
- 📦 Easy to install and use
- 🎯 Simple Artisan command for backups
- 💾 Automatic backup file management
- 🔧 Configurable backup settings

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

[](#installation)

```
composer require programinglive/laravel-simple-backup
```

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

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --provider="ProgrammingLive\LaravelSimpleBackup\LaravelSimpleBackupServiceProvider" --tag="backup-config"
```

This will create a `config/backup.php` file where you can configure your backup settings.

Usage
-----

[](#usage)

### Using Artisan Command

[](#using-artisan-command)

Backup the default database connection:

```
php artisan backup:database
```

Backup a specific database connection:

```
php artisan backup:database --connection=mysql
```

Or for PostgreSQL:

```
php artisan backup:database --connection=pgsql
```

### Using the Backup Manager Class

[](#using-the-backup-manager-class)

```
use ProgrammingLive\LaravelSimpleBackup\BackupManager;

// Backup the default connection
$filepath = BackupManager::backup();

// Backup a specific connection
$filepath = BackupManager::backup('mysql');

// Get all backups
$backups = BackupManager::getBackups();

// Delete a backup
BackupManager::deleteBackup('backup_mydb_2024-12-08_10-30-45.sql');

// Download a backup
$filepath = BackupManager::downloadBackup('backup_mydb_2024-12-08_10-30-45.sql');
```

### Using the Facade

[](#using-the-facade)

```
use ProgrammingLive\LaravelSimpleBackup\Facades\Backup;

// Backup the database
$filepath = Backup::backup();

// Get all backups
$backups = Backup::getBackups();
```

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

[](#requirements)

- PHP 8.1 or higher
- Laravel 9.0, 10.0, 11.0, or 12.0
- MySQL or PostgreSQL with command-line tools installed

### System Requirements

[](#system-requirements)

For MySQL backups, ensure `mysqldump` is installed:

- **Windows**: Usually included with MySQL installation
- **Linux**: `sudo apt-get install mysql-client`
- **macOS**: `brew install mysql-client`

For PostgreSQL backups, ensure `pg_dump` is installed:

- **Windows**: Usually included with PostgreSQL installation
- **Linux**: `sudo apt-get install postgresql-client`
- **macOS**: `brew install postgresql`

Backup File Location
--------------------

[](#backup-file-location)

Backups are stored in the `storage/backups` directory by default. You can change this in the `config/backup.php` file.

Backup File Format
------------------

[](#backup-file-format)

Backup files are named with the following format:

```
backup_{database_name}_{YYYY-MM-DD_HH-MM-SS}.sql

```

Example:

```
backup_myapp_2024-12-08_10-30-45.sql

```

Testing
-------

[](#testing)

### Running Tests

[](#running-tests)

```
# Run all tests
vendor/bin/phpunit

# Run specific test file
vendor/bin/phpunit tests/BackupManagerTest.php

# Run with coverage
vendor/bin/phpunit --coverage-html coverage
```

### Testing in a Laravel Project

[](#testing-in-a-laravel-project)

To test this package in a real Laravel project:

1. Create a new Laravel project:

    ```
    composer create-project laravel/laravel test-backup-app
    cd test-backup-app
    ```
2. Add the package as a local repository in `composer.json`:

    ```
    "repositories": [
        {
            "type": "path",
            "url": "../laravel-simple-backup"
        }
    ]
    ```
3. Install the package:

    ```
    composer require programinglive/laravel-simple-backup:@dev
    ```
4. Configure your database in `.env` and run:

    ```
    php artisan backup:database
    ```
5. Check the backup file in `storage/backups/`

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.

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) file for details.

Support
-------

[](#support)

For issues and feature requests, please visit the [GitHub repository](https://github.com/programinglive/laravel-simple-backup).

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance73

Regular maintenance activity

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 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

152d ago

PHP version history (2 changes)v0.0.1PHP ^8.2

v0.0.3PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/550e2f2856541fa7edc36addb1fd5628e71dae0a761202f0621b2893376e4d22?d=identicon)[programinglive](/maintainers/programinglive)

---

Top Contributors

[![mahatmamahardhikach](https://avatars.githubusercontent.com/u/5633266?v=4)](https://github.com/mahatmamahardhikach "mahatmamahardhikach (10 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/programinglive-laravel-simple-backup/health.svg)

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

###  Alternatives

[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[cviebrock/eloquent-sluggable

Easy creation of slugs for your Eloquent models in Laravel

4.0k13.6M251](/packages/cviebrock-eloquent-sluggable)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8425.3M87](/packages/laravel-doctrine-orm)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)[clickbar/laravel-magellan

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

423715.4k1](/packages/clickbar-laravel-magellan)[cybercog/laravel-clickhouse

ClickHouse migrations for Laravel

163166.8k](/packages/cybercog-laravel-clickhouse)

PHPackages © 2026

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