PHPackages                             h2akim/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. h2akim/backup

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

h2akim/backup
=============

An easy way backup and restore databases in Laravel.

v1.0.0(10y ago)129MITPHPPHP &gt;=5.4.0

Since Jun 30Pushed 10y ago1 watchersCompare

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

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

An easy way backup and restore databases in Laravel.
====================================================

[](#an-easy-way-backup-and-restore-databases-in-laravel)

Fork from Cornford/Backup

- Add Laravel 4.1 Support

Think of Backup as an easy way to backup and restore a database, with command line integration to Laravel's artisan. These include:

- `Backup::export`
- `Backup::restore`
- `Backup::setBackupEngineInstance`
- `Backup::getBackupEngineInstance`
- `Backup::setBackupFilesystemInstance`
- `Backup::getBackupFilesystemInstance`
- `Backup::setEnabled`
- `Backup::getEnabled`
- `Backup::setPath`
- `Backup::getPath`
- `Backup::setCompress`
- `Backup::getCompress`
- `Backup::setFilename`
- `Backup::getFilename`
- `Backup::getWorkingFilepath`
- `Backup::getRestorationFiles`
- `Backup::getProcessOutput`

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

[](#installation)

Begin by installing this package through Composer. Edit your project's `composer.json` file to require `cornford/backup`.

```
"require": {
	"h2akim/backup": "dev-master"
}

```

Next, update Composer from the Terminal:

```
composer update

```

Once this operation completes, the next step is to add the service provider. Open `app/config/app.php`, and add a new item to the providers array.

```
'H2akim\Backup\Providers\BackupServiceProvider',

```

The next step is to introduce the facade. Open `app/config/app.php`, and add a new item to the aliases array.

```
'Backup'         => 'H2akim\Backup\Facades\Backup',

```

Finally we need to introduce the configuration files into your application.

```
php artisan config:publish h2akim/backup

```

That's it! You're all set to go.

Usage
-----

[](#usage)

It's really as simple as using the Backup class in any Controller / Model / File you see fit with:

`Backup::`

This will give you access to

- [Export](#export)
- [Restore](#Restore)
- [Set Backup Engine Instance](#set-backup-engine-instance)
- [Get Backup Engine Instance](#get-backup-engine-instance)
- [Set Backup Filesystem Instance](#set-backup-filesystem-instance)
- [Get Backup Filesystem Instance](#get-backup-filesystem-instance)
- [Set Enabled](#set-enabled)
- [Get Enabled](#get-enabled)
- [Set Path](#set-path)
- [Get Path](#get-path)
- [Set Compress](#set-compress)
- [Get Compress](#get-compress)
- [Set Filename](#set-filename)
- [Get Filename](#get-filename)
- [Get Working Filepath](#get-working-filepath)
- [Get Restoration Files](#get-restoration-files)
- [Get Process Output](#get-process-output)

### Export

[](#export)

The `export` method allows a database export file to be created in the defined backup location, with an optional filename option.

```
Backup::export();
Backup::export('database_backup');

```

### Restore

[](#restore)

The `restore` method allows a database export file to be restored to the database, specifying a full filepath to the file.

```
Backup::restore('./database_backup.sql');

```

### Set Backup Engine Instance

[](#set-backup-engine-instance)

The `setBackupEngineInstance` method allows a custom backup engine instance object to be utilised, implementing the BackupEngineInterface.

```
Backup::setBackupEngineInstance(new BackupEngineMysql(new BackupProcess(new Symfony\Component\Process\Process), 'database', 'localhost', 3306, 'root', '', []));

```

### Get Backup Engine Instance

[](#get-backup-engine-instance)

The `getBackupEngineInstance` method returns the current backup engine instance object.

```
Backup::getBackupEngineInstance();

```

### Set Backup Filesystem Instance

[](#set-backup-filesystem-instance)

The `setBackupFilesystemInstance` method allows a custom backup filesystem instance object to be utilised, implementing the BackupFilesystemInterface.

```
Backup::setBackupFilesystemInstance(new BackupFilesystemInstance);

```

### Get Backup Filesystem Instance

[](#get-backup-filesystem-instance)

The `getBackupFilesystemInstance` method returns the current backup filesystem instance object.

```
Backup::getBackupFilesystemInstance();

```

### Set Enabled

[](#set-enabled)

The `setEnabled` method allows backup to be switched on or off, specifying a boolean for state.

```
Backup::setEnabled(true);
Backup::setEnabled(false);

```

### Get Enabled

[](#get-enabled)

The `getEnabled` method returns the current backup enabled status, returning a boolean for its state.

```
Backup::getEnabled();

```

### Set Path

[](#set-path)

The `setPath` method allows backup location path to be set, specifying a relative or absolute path as a string, a trailing slash is required.

```
Backup::setPath('/path/to/directory/');

```

### Get Path

[](#get-path)

The `getPath` method returns the current absolute backup path in string format.

```
Backup::getPath();

```

### Set Compress

[](#set-compress)

The `setCompress` method allows backup file compression to be switched on or off, specifying a boolean for state.

```
Backup::setCompress(true);
Backup::setCompress(false);

```

### Get Compress

[](#get-compress)

The `getCompress` method returns the current compression backup status, returning a boolean for its state.

```
Backup::getCompress();

```

### Set Filename

[](#set-filename)

The `setFilename` method allows backup filename to be set, specified in a string format.

```
Backup::setFilename('database_backup');
Backup::setFilename('backup-' . date('Ymd-His'));

```

### Get Filename

[](#get-filename)

The `getFilename` method returns the current set backup filename in a string format.

```
Backup::getFilename();

```

### Get Working Filepath

[](#get-working-filepath)

The `getWorkingFilepath` method returns the current set working filepath of the current item being processed in a string format.

```
Backup::getWorkingFilepath();

```

### Get Restoration Files

[](#get-restoration-files)

The `getRestorationFiles` method returns an array containing all of the restoration file filepaths within a give path, an optional absolute path can be set as a string.

```
Backup::getRestorationFiles();
Backup::getRestorationFiles('/path/to/directory/');

```

### License

[](#license)

Backup is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

3976d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6195de079fa9258ea11c8f2255bf95af31ffb2c76526ba7367ba38b9456edc8d?d=identicon)[h2akim](/maintainers/h2akim)

---

Top Contributors

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

---

Tags

laraveldatabasebackupdumprestore

### Embed Badge

![Health badge](/badges/h2akim-backup/health.svg)

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

###  Alternatives

[cornford/backup

An easy way backup and restore databases in Laravel.

4225.6k](/packages/cornford-backup)[cybercog/laravel-clickhouse

ClickHouse migrations for Laravel

163166.8k](/packages/cybercog-laravel-clickhouse)[rah/danpu

Zero-dependency MySQL dump library for easily exporting and importing databases

64401.8k10](/packages/rah-danpu)[toponepercent/baum

Baum is an implementation of the Nested Set pattern for Eloquent models.

3154.7k](/packages/toponepercent-baum)[sarfraznawaz2005/backupmanager

laravel package to backup/restore files and database.

313.7k](/packages/sarfraznawaz2005-backupmanager)[dragon-code/laravel-data-dumper

Adding data from certain tables when executing the `php artisan schema:dump` console command

3418.6k](/packages/dragon-code-laravel-data-dumper)

PHPackages © 2026

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