PHPackages                             coreproc/laravel-db-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. coreproc/laravel-db-backup

ActiveLibrary

coreproc/laravel-db-backup
==========================

0.3.1(10y ago)473.1k15[1 issues](https://github.com/CoreProc/laravel-db-backup/issues)[1 PRs](https://github.com/CoreProc/laravel-db-backup/pulls)PHPPHP &gt;=5.4.0

Since Oct 8Pushed 7y ago5 watchersCompare

[ Source](https://github.com/CoreProc/laravel-db-backup)[ Packagist](https://packagist.org/packages/coreproc/laravel-db-backup)[ RSS](/packages/coreproc-laravel-db-backup/feed)WikiDiscussions master Synced 5d ago

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

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

[](#laravel-db-backup)

[![Join the chat at https://gitter.im/CoreProc/laravel-db-backup](https://camo.githubusercontent.com/abe08b740a4156153736f791393ec4da6619c4be73212e75769f52edacc0e2b5/68747470733a2f2f6261646765732e6769747465722e696d2f4a6f696e253230436861742e737667)](https://gitter.im/CoreProc/laravel-db-backup?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Artisan command to backup your database. Built for Laravel 4.2. Originally forked from [schickling/laravel-backup](https://github.com/schickling/laravel-backup) but modified to push in more features like data retention from Amazon S3 and Slack notifications.

Quick start
-----------

[](#quick-start)

### Required setup

[](#required-setup)

In the `require` key of `composer.json` file add the following

```
"coreproc/laravel-db-backup": "0.*"

```

Run the Composer update comand

```
$ composer update

```

In your `app/config/app.php` add `'Coreproc\LaravelDbBackup\LaravelDbBackupServiceProvider'` to the end of the `$providers` array

```
'providers' => array(

    'Illuminate\Foundation\Providers\ArtisanServiceProvider',
    'Illuminate\Auth\AuthServiceProvider',
    ...
    'EllipseSynergie\ApiResponse\Laravel\ResponseServiceProvider',
    'Coreproc\LaravelDbBackup\LaravelDbBackupServiceProvider',

),

```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

You can quickly backup your database using the command line below

`php artisan db:backup`

This command will backup the database that your Laravel application is connected to. This means that the `default` configuration from `app/config/database.php` will be used.

By default, the file will be saved in the `app/storage/dumps` path and will be named like this: `{database_name}_{unix_timestamp}.sql`.

If you want to use another database, just add another configuration to the `connection` value. A sample configuration in `app/config/database.php` would look like this:

```
'connections' => array(

    'dbconnection1'  => array(
        'driver'         => 'mysql',
        'host'           => 'localhost',
        'database'       => 'db1',
        'username'       => 'user',
        'password'       => 'password',
        'charset'        => 'utf8',
        'collation'      => 'utf8_unicode_ci',
        'prefix'         => '',
        'slackWebhookPath'  => 'T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX'
    ),

    'dbconnection2'  => array(
        'driver'            => 'mysql',
        'host'              => 'localhost',
        'database'          => 'db1',
        'username'          => 'user',
        'password'          => 'password',
        'charset'           => 'utf8',
        'collation'         => 'utf8_unicode_ci',
        'prefix'            => '',
        'slackWebhookPath'  => 'T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX'
    ),

),

```

So if you want to back up, let's say, dbconnection2, you would add the `--database` option to our artisan command.

`php artisan db:backup --database=dbconnection2`

### Slack Integration

[](#slack-integration)

[Slack](https://slack.com) is a platform/service for team communication. Using the [Incoming Webhooks](https://api.slack.com/incoming-webhooks) integration you can send real-time messages to any channel on your team's Slack.

If you'll notice, we have added an extra variable to the database configuration (`slackWebhookPath`). To begin receiving your database backup notifications you first have to add the [Incoming Webhooks integration](https://my.slack.com/services/new/incoming-webhook/) for your Slack team. Once set up you will be given a unique `Webhook URL` which will look something like this: *`https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX`*. Just copy your unique webhook path (`T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX`) and add it to your database configuration.

To disable the Slack integrations, either leave the value blank or you can disable Slack notifications manually by using the `--disable-slack` option. Here is an example:

``php artisan db:backup --database=dbconnection2 --disable-slack`

### Upload to Amazon S3

[](#upload-to-amazon-s3)

To upload to you Amazon S3 bucket, you will need to put in your AWS settings first. By default, this package is shipped with the [aws/aws-sdk-php-laravel](https://github.com/aws/aws-sdk-php-laravel) package so we'll modify the settings from there.

To bring out the config file of the AWS library, you'll need to generate it by using the command below:

`php artisan config:publish aws/aws-sdk-php-laravel`

You will find the AWS config file in the following path: `app/config/packages/aws/aws-sdk-php-laravel/config.php`. Fill in the appropriate values.

To upload the database backup to S3, use the `--upload-s3` option:

`php artisan db:backup --database=dbconnection2 --upload-s3=s3_bucket_name`

Change the value of the `--upload-s3` to the name of the bucket you want to upload to.

If you want to keep only S3 copy of your backups, set `--s3-only`, which will delete local copy of backup when S3 upload is enabled.

`php artisan db:backup --database=dbconnection2 --upload-s3=s3_bucket_name --s3-only=true`

### Database Retention (S3 only for now)

[](#database-retention-s3-only-for-now)

If you want to only keep a certain number of copies of your database, you can set the `--data-retention-s3` option to the number of days you want to retain your data. Here is an example:

`php artisan db:backup --database=dbconnection2 --data-retention=30`

### Change filename

[](#change-filename)

You can change the name of the backup file with the `--filename` option. All filenames will be appended with the unix timestamp.

`php artisan db:backup --database=dbconnection2 --filename=test`

### Save as ZIP archive

[](#save-as-zip-archive)

To create zip archive instead of raw .sql file, set `--archive` value.

`php artisan db:backup --database=dbconnection2 --data-retention=30 --archive=true`

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 67.9% 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 ~50 days

Recently: every ~61 days

Total

6

Last Release

3987d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7066371?v=4)[CoreProc](/maintainers/coreproc)[@CoreProc](https://github.com/CoreProc)

---

Top Contributors

[![chrisbjr](https://avatars.githubusercontent.com/u/571279?v=4)](https://github.com/chrisbjr "chrisbjr (19 commits)")[![aromka](https://avatars.githubusercontent.com/u/2651029?v=4)](https://github.com/aromka "aromka (3 commits)")[![edbentinck](https://avatars.githubusercontent.com/u/6202888?v=4)](https://github.com/edbentinck "edbentinck (3 commits)")[![gitter-badger](https://avatars.githubusercontent.com/u/8518239?v=4)](https://github.com/gitter-badger "gitter-badger (1 commits)")[![lamoni](https://avatars.githubusercontent.com/u/5675626?v=4)](https://github.com/lamoni "lamoni (1 commits)")[![shkabo](https://avatars.githubusercontent.com/u/1276333?v=4)](https://github.com/shkabo "shkabo (1 commits)")

### Embed Badge

![Health badge](/badges/coreproc-laravel-db-backup/health.svg)

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[laravel/pennant

A simple, lightweight library for managing feature flags.

57311.1M53](/packages/laravel-pennant)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

44643.1k1](/packages/pressbooks-pressbooks)

PHPackages © 2026

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