PHPackages                             asmbs/mysql-s3-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. asmbs/mysql-s3-backup

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

asmbs/mysql-s3-backup
=====================

Manages backups of a MySQL database to Amazon S3

v2.0.3(6y ago)18MITPHPPHP &gt;=7.2

Since Jun 18Pushed 3y ago3 watchersCompare

[ Source](https://github.com/asmbs/mysql-s3-backup)[ Packagist](https://packagist.org/packages/asmbs/mysql-s3-backup)[ Docs](https://github.com/asmbs/mysql-s3-backup)[ RSS](/packages/asmbs-mysql-s3-backup/feed)WikiDiscussions master Synced yesterday

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

MySQL S3 Backup
===============

[](#mysql-s3-backup)

> Manages backups of a MySQL database to Amazon S3

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

[](#requirements)

- PHP 7.2+
- MySQL 4.1.0+
- Composer 1.6.5+

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

[](#installation)

1. Create an empty, non-versioned S3 bucket. The first time that the script runs, it will create 4 folders for you ("yearly", "monthly", "daily", and "hourly").
2. Copy `config.yaml.dist` to a new file named `config.yaml` in the same directory and configure it to your needs, per the Configuration Reference below.
3. Install the dependencies:

    ```
    composer install

    ```
4. Set up a single `cron` job to execute `MySQLS3Backup.php` once every hour. Using `crontab`, an example line would be:

    ```
    0 * * * * php /path/to/mysql-s3-backup/src/MySQLS3Backup.php app:manage

    ```

The backup files will be created in the format `YYYY-MM-DD_HH-MM-SS.EXT`, where `EXT` is the file extension based on the compression method chosen (`sql` for "None", `gz` for "Gzip", and `bz2` for "Bzip2"). The file names should not be changed inside the bucket, or else the script will not be able to recognize the files.

Usage
-----

[](#usage)

You can manually execute the "manage" command by running:

```
php src/MySQLS3Backup.php app:manage

```

To download a previous dump that was uploaded using client-side encryption, it must be downloaded with the "download-encrypted" command. You can do this by running:

```
php src/MySQLS3Backup.php app:download-encrypted "hourly/2019-06-19_16-07-24.sql.gz" --output-file="/var/tmp/bar.sql.gz"

```

Configuration Reference
-----------------------

[](#configuration-reference)

- `s3`
    - `arguments`
        - `version` The S3 version to use
        - `region` The S3 region to use
        - `credentials`
            - `key` Your S3 key
            - `secret` Your S3 secret
    - `client_encryption`
        - `enabled` If set to true, then dump files will be transferred to S3 using client-side encryption with an AWS KMS-managed customer master key. If set to false, then plain non-encrypted transfer will be used.
            - `arguments`
                - `version`
                - `region`
                - `credentials`
                    - `key`
                    - `secret`
            - `key_arn` The ARN of the KMS-managed customer key to use. Typically, this will begin with "arn:aws:kms".
            - `cipher_options`
                - Should be "cbc" or "gcm". See AWS PHP SDK documentation.
                - Should be "128", "192", or "256". See AWS PHP SDK documentation.
- `sns`
    - `enabled` If set to true, then exceptions will be sent to an Amazon SNS Topic. If set to false, exceptions will simply be outputted.
    - `arguments`
        - `version`
        - `region`
        - `credentials`
            - `key`
            - `secret`
    - `topic_arn` The ARN of the Amazon SNS Topic to use. Typically, this will begin with "arn:aws:sns".
- `mysql`
    - `host` The host on which your database is hosted
    - `dbname` The name of your database
    - `username` The username to be used by MySQL
    - `password` The password to be used by MySQL
- `app`
    - `output` If set to true, then information will be outputted. If set to false, the script will run silently (except for exceptions).
    - `compression` The compression algorithm to use. This should be 'None', 'Gzip', or 'Bzip2'. Note that bzip2 support is [not enabled by default in PHP](http://php.net/manual/en/bzip2.installation.php).
    - `maximum_backup_counts` This is the maximum number of backups to keep based on each time period. For example, setting 'yearly' to '7' will keep **one** backup for each of the past 7 years. When a day rolls over, the most recent 'hourly' backup will be used.
    - `yearly`
    - `monthly`
    - `daily`
    - `hourly`
    - `mirror_default_opt` If set to true, then the dump settings will mirror the default `--opt` [setting](https://dev.mysql.com/doc/refman/5.7/en/mysqldump.html#option_mysqldump_opt) of MySQL's original `mysqldump`.
    - `add_sql_extension` If set to true, then `.sql` will be added before the compression extension (e.g. `.gz`) in compressed backups.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

Recently: every ~120 days

Total

7

Last Release

2302d ago

Major Versions

v0.0.1 → v1.0.02018-06-27

v1.1.0 → v2.0.02019-06-19

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2086816?v=4)[ASMBS](/maintainers/asmbs)[@asmbs](https://github.com/asmbs)

---

Top Contributors

[![maxwellmc](https://avatars.githubusercontent.com/u/25797126?v=4)](https://github.com/maxwellmc "maxwellmc (35 commits)")

---

Tags

s3backupmysqlmysqldump

### Embed Badge

![Health badge](/badges/asmbs-mysql-s3-backup/health.svg)

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

###  Alternatives

[spatie/laravel-backup

A Laravel package to backup your application

6.0k21.8M191](/packages/spatie-laravel-backup)[backup-manager/symfony

A simple database backup manager for Symfony2 with support for S3, Rackspace, Dropbox, FTP, SFTP.

119293.7k3](/packages/backup-manager-symfony)[rah/danpu

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

64401.8k10](/packages/rah-danpu)[cytopia/mysqldump-secure

Secure mysqldump script with encryption, compression, logging, blacklisting and Nagios monitoring integration

1474.7k1](/packages/cytopia-mysqldump-secure)[phpsu/phpsu

Synchronisation Utility: File and Database

1685.6k](/packages/phpsu-phpsu)

PHPackages © 2026

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