PHPackages                             henrywood/swoole-database-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. henrywood/swoole-database-backup

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

henrywood/swoole-database-backup
================================

Handles database backup

v2.6.0(1mo ago)0317MITPHPPHP ^8.1

Since Nov 8Pushed 5mo agoCompare

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

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

Database Backup
===============

[](#database-backup)

Takes database backup after certain interval

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

[](#installation)

`composer require henrywood/swoole-database-backup`

Usage
-----

[](#usage)

```
use DatabaseBackup\Backup;
use DatabaseBackup\Helpers\Console;

// Backup Class (NucleusBackup.php)
class NucleusBackup extends AbstractBackup
{
    protected bool $sendMailOnError = false;
    protected bool $sendMailOnSuccess = false;

    public function interval(): int
    {
        return 2_000;
    }

    public function filePath(): string
    {
        return sprintf('%s/nucleus-%s.sql', dirname(__DIR__, 2), uniqid());
    }

    public function onSuccess(string $path, callable $done): void
    {
        $done();
        Console::info('nucleus backup completed');
        unlink($path);
    }

    public function connection(): DatabaseConnection
    {
        return new DatabaseConnection(
            driver: DatabaseDriver::MYSQL,
            host: 'localhost',
            username: 'root',
            password: '1234',
            database: 'nucleus'
        );
    }
}

// Runner (run.php)
use Swoole\Runtime;
use DatabaseBackup\Backup;
use DatabaseBackup\Helpers\Console;

require __DIR__ . '/vendor/autoload.php';

Runtime::enableCoroutine(SWOOLE_HOOK_ALL);

Console::writeln("Backup service started");

// Run backups
Backup::new()->start([NucleusBackup::class]);
```

### Mail Notification

[](#mail-notification)

```
use DatabaseBackup\Backup;

$receivers = [
    new MailReceiver(
        email: 'jane.doe@example.com',
        name: 'Jane Doe'
    ),
];

$smtp = new SmtpCredential(
    host: 'localhost',
    port: 8025,
    username: 'noreply@example.com',
    password: 'Password',
    auth: false
);

Backup::new()
    ->withSmtp($smtp)
    ->withMailReceivers($receivers)
    ->start([NucleusBackup::class]);
```

This library is **MIT Licenced**

Enjoy 😉

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance79

Regular maintenance activity

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63.2% 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 ~13 days

Recently: every ~33 days

Total

11

Last Release

47d ago

Major Versions

v1.3.0 → v2.0.02025-11-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/3dc3096179e417ec41d97f5b29a742468b4ec9d3ce8f58f1f201360ce84171f7?d=identicon)[henrywood](/maintainers/henrywood)

---

Top Contributors

[![henrywood](https://avatars.githubusercontent.com/u/4231163?v=4)](https://github.com/henrywood "henrywood (12 commits)")[![Ahmard](https://avatars.githubusercontent.com/u/44737217?v=4)](https://github.com/Ahmard "Ahmard (7 commits)")

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/henrywood-swoole-database-backup/health.svg)

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

###  Alternatives

[leantime/leantime

Open source project management system for non-project managers. Simple like Trello, powerful like Jira. Built with neurodiversity in mind.

9.4k2.8k](/packages/leantime-leantime)[phpauth/phpauth

A secure user authentication class for PHP websites, using a powerful password hashing system and attack blocking to keep your website and users secure.

894196.1k3](/packages/phpauth-phpauth)

PHPackages © 2026

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