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

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

pgt/backup
==========

Simple, zero-dependency database backups to S3 for Laravel applications

v1.0.0(1mo ago)193↓60.3%MITPHPPHP ^8.2

Since May 28Pushed 1mo agoCompare

[ Source](https://github.com/Parsons-Green-Media/pgt-backup)[ Packagist](https://packagist.org/packages/pgt/backup)[ RSS](/packages/pgt-backup/feed)WikiDiscussions main Synced 1w ago

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

PGT Backup
==========

[](#pgt-backup)

A simple, zero-configuration Laravel package that backs up your database to S3 (or any Laravel filesystem disk) on a schedule.

- Supports MySQL, PostgreSQL, and SQLite
- Compresses backups with gzip — no uncompressed data written to disk
- Configurable retention: automatically prunes old backups
- Runs daily at 2am by default via Laravel's scheduler
- Logs output to `storage/logs/pgt-backup.log`

---

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

[](#requirements)

- PHP 8.2+
- Laravel 10, 11, or 12
- `mysqldump` (MySQL) or `pg_dump` (PostgreSQL) installed on the server

---

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

[](#installation)

```
composer require pgt/backup
```

The service provider is auto-discovered. No manual registration needed.

---

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

[](#configuration)

Publish the config file:

```
php artisan vendor:publish --tag=pgt-backup-config
```

This creates `config/pgt-backup.php`. The defaults work out of the box if you have standard `AWS_*` environment variables set.

### Environment variables

[](#environment-variables)

VariableDefaultDescription`BACKUP_DISK``s3`Filesystem disk to upload to`BACKUP_PATH``pgt-backups`Directory path within the disk (root folder by default)`BACKUP_CONNECTION`*(default DB connection)*Database connection to back up`BACKUP_REPLACE``false`Overwrite today's backup on re-run (date-only filename)`BACKUP_KEEP`*(none)*Max number of backup files to retain`BACKUP_KEEP_FOR_DAYS``30`Delete backups older than this many days`BACKUP_CRON``0 2 * * *`Cron schedule (default: 2am daily)`BACKUP_TIMEZONE`*(app timezone)*Timezone for the scheduleBoth `BACKUP_KEEP` and `BACKUP_KEEP_FOR_DAYS` can be set simultaneously — a file is pruned if it violates either rule.

### AWS setup

[](#aws-setup)

Add standard AWS credentials to your `.env`:

```
AWS_ACCESS_KEY_ID=your-key-id
AWS_SECRET_ACCESS_KEY=your-secret
AWS_DEFAULT_REGION=eu-west-2
AWS_BUCKET=your-bucket-name
```

Ensure your S3 bucket policy allows `PutObject`, `GetObject`, `ListBucket`, and `DeleteObject` for the credentials you provide.

---

Scheduler
---------

[](#scheduler)

Add Laravel's scheduler to your server cron (once — if not already done):

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

The package registers its own schedule automatically. No changes to `app/Console/Kernel.php` are needed.

To disable the automatic schedule and run manually, set `BACKUP_CRON=` (empty) in your `.env`.

---

Running manually
----------------

[](#running-manually)

```
php artisan pgt:backup
```

Override the connection or disk at runtime:

```
php artisan pgt:backup --connection=mysql --disk=s3
```

---

Backup files
------------

[](#backup-files)

Backups are stored as gzip-compressed SQL files. The filename format depends on the `replace` setting:

```
# replace = false (default) — one file per run, never overwritten
pgt-backups/2026-05-28_02-00-00_backup.sql.gz

# replace = true — one file per day, re-running the same day overwrites it
pgt-backups/2026-05-28_backup.sql.gz

```

Old backups are pruned automatically after each successful run based on your retention settings.

---

Logs
----

[](#logs)

Each scheduled run appends output to:

```
storage/logs/pgt-backup.log

```

---

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance89

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

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

57d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/17324531?v=4)[James Parsons](/maintainers/snips11)[@snips11](https://github.com/snips11)

---

Top Contributors

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

---

Tags

laravels3databasebackupmysqlpostgres

### Embed Badge

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

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

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M246](/packages/laravel-ai)[illuminate/queue

The Illuminate Queue package.

20432.6M1.7k](/packages/illuminate-queue)[spatie/laravel-backup

A Laravel package to backup your application

6.0k24.4M254](/packages/spatie-laravel-backup)[erag/laravel-lang-sync-inertia

A powerful Laravel package for syncing and managing language translations across backend and Inertia.js (Vue/React/Svelte) frontends, offering effortless localization, auto-sync features, and smooth multi-language support for modern Laravel applications.

4925.3k](/packages/erag-laravel-lang-sync-inertia)[orptech/laravel-migration-partition

Laravel extensions that extends Illuminate to enable partitioned table creation within Laravel migrations.

3829.0k](/packages/orptech-laravel-migration-partition)

PHPackages © 2026

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