PHPackages                             devuni/notifier-package - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. devuni/notifier-package

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

devuni/notifier-package
=======================

Laravel package for automated backups and notifications.

v2.6.0(1mo ago)21.7k[1 PRs](https://github.com/devuni-cz/notifier-package/pulls)MITPHPPHP ^8.4CI passing

Since Jul 10Pushed 2mo agoCompare

[ Source](https://github.com/devuni-cz/notifier-package)[ Packagist](https://packagist.org/packages/devuni/notifier-package)[ Docs](https://github.com/devuni-cz/notifier-package)[ RSS](/packages/devuni-notifier-package/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (22)Versions (63)Used By (0)

Devuni Notifier Package
=======================

[](#devuni-notifier-package)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b05caf685eff5fea99b8e9b264156153f010a50a9f4544ebe3229e2fc53f406b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646576756e692f6e6f7469666965722d7061636b6167652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/devuni/notifier-package)[![Total Downloads](https://camo.githubusercontent.com/64ffa7d381bc02a9bfca4502b633953a4dc5552d898cb52d6455f3608a0172a7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646576756e692f6e6f7469666965722d7061636b6167652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/devuni/notifier-package)[![Tests](https://github.com/devuni-cz/notifier-package/actions/workflows/ci.yml/badge.svg)](https://github.com/devuni-cz/notifier-package/actions/workflows/ci.yml)[![PHP 8.4](https://camo.githubusercontent.com/d072d1f17b6a8dc799e782e39d676d25cab3e73854efe49206d6ffcb6473abd4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e342d3737374242343f7374796c653d666c61742d737175617265266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://www.php.net)[![Laravel 12](https://camo.githubusercontent.com/06ea735703a9f1df04eafc3035859ba230f5b3396114bb712770feb5eb1ded4f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31322d4646324432303f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465)](https://laravel.com)[![PHPStan Level 5](https://camo.githubusercontent.com/c7d4c25ec55f9e858a5e02f27902f10222db2768c0d4cb052a2327ea85701b35/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230352d626c75653f7374796c653d666c61742d737175617265)](https://phpstan.org)[![Code Style](https://camo.githubusercontent.com/3b3c737aea496c6e1d101e71596a571b3cb6f4e999ae19f620f7c7a1a211ba23/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64652532307374796c652d70696e742d6f72616e67653f7374796c653d666c61742d737175617265)](https://laravel.com/docs/pint)[![License: MIT](https://camo.githubusercontent.com/422db9fd40f5831c765cf6530b6750c081b696bd18d904cf89554df98c676277/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e3f7374796c653d666c61742d737175617265)](LICENSE.md)

A Laravel package for automated, encrypted database and storage backups with secure remote delivery. Supports Artisan commands, HTTP API triggers, queue offloading, and AES-256 ZIP encryption out of the box.

Features
--------

[](#features)

- **Database backups** — `mysqldump` with `--single-transaction` and `--quick` for consistent, low-memory dumps
- **Storage backups** — Archives `storage/app/public` into password-protected ZIP (AES-256)
- **Pluggable ZIP strategy** — CLI `7z` (recommended) with PHP `ZipArchive` fallback
- **Chunked uploads** — Large backup files split into configurable chunks (default 20 MB) for reliable transfer
- **Token-based authentication** — `X-Notifier-Token` header validated with constant-time comparison
- **Queue support** — Offload backup jobs to any Laravel queue driver to avoid HTTP timeout limits
- **Remote API trigger** — Rate-limited REST endpoint to trigger backups from an external scheduler
- **Exclusion lists** — Ignore specific database tables and storage files/directories
- **Configurable routing** — Custom route prefix, or disable routes entirely
- **Comprehensive logging** — Dedicated configurable logging channel with automatic fallback
- **Automatic cleanup** — Temporary backup files removed after successful upload

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

[](#requirements)

- PHP `^8.4`
- Laravel `^12.2`
- `mysqldump` binary for database backups
- `7z` (`p7zip-full`) recommended for storage backups, or PHP `zip` extension as fallback

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

[](#installation)

### 1. Install via Composer

[](#1-install-via-composer)

```
composer require devuni/notifier-package
```

### 2. Publish the configuration

[](#2-publish-the-configuration)

```
php artisan vendor:publish --tag="notifier-config"
```

This copies `config/notifier.php` into your application's `config/` directory.

### 3. Configure environment variables

[](#3-configure-environment-variables)

Run the interactive installer to write the required values to your `.env`:

```
php artisan notifier:install
```

### 4. Verify your setup

[](#4-verify-your-setup)

```
php artisan notifier:check
```

This command validates your environment variables, database connectivity, storage access, system tools (`mysqldump`, `7z`), logging channel, and backup URL reachability.

---

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

[](#configuration)

After publishing, edit `config/notifier.php` or set values via environment variables.

### Environment Variables

[](#environment-variables)

```
# Required
NOTIFIER_BACKUP_CODE=your-secret-token       # Authentication token (must match the central notifier)
NOTIFIER_URL=https://your-backup-server.com  # Endpoint that receives backup uploads
NOTIFIER_BACKUP_PASSWORD=your-zip-password   # AES-256 ZIP encryption password

# Optional
NOTIFIER_LOGGING_CHANNEL=backup              # Laravel logging channel (default: backup)
NOTIFIER_ROUTES_ENABLED=true                 # Enable/disable the API route (default: true)
NOTIFIER_ROUTE_PREFIX=api/notifier           # API route prefix (default: api/notifier)
NOTIFIER_ZIP_STRATEGY=auto                   # ZIP strategy: auto, cli, php (default: auto)
NOTIFIER_CHUNK_SIZE=20971520                 # Upload chunk size in bytes (default: 20 MB)
NOTIFIER_QUEUE_CONNECTION=sync               # Queue driver for API-triggered backups (default: sync)
```

### All Configuration Options

[](#all-configuration-options)

KeyEnv VariableDefaultDescription`backup_code``NOTIFIER_BACKUP_CODE`—Authentication token matched against `X-Notifier-Token` header`backup_url``NOTIFIER_URL`—Central notifier endpoint for backup uploads`backup_zip_password``NOTIFIER_BACKUP_PASSWORD`—Password used to encrypt backup ZIP archives`excluded_tables`—`[]`Database tables excluded from backup (e.g. `telescope_entries`, `sessions`)`excluded_files`—`['.gitignore']`Files/dirs excluded from storage backup (relative to `storage/app/public`)`logging_channel``NOTIFIER_LOGGING_CHANNEL``backup`Laravel log channel; falls back to `daily` if channel doesn't exist`routes_enabled``NOTIFIER_ROUTES_ENABLED``true`Whether to register the package's API route`route_prefix``NOTIFIER_ROUTE_PREFIX``api/notifier`URL prefix for the API route`zip_strategy``NOTIFIER_ZIP_STRATEGY``auto`ZIP strategy: `auto` (detect), `cli` (force 7z), `php` (force ZipArchive)`chunk_size``NOTIFIER_CHUNK_SIZE``20971520`Upload chunk size in bytes. Keep under your proxy's limit (e.g. Cloudflare free: 100 MB)`queue_connection``NOTIFIER_QUEUE_CONNECTION``sync`Queue driver for API-triggered backups. Artisan commands always run synchronously.---

Artisan Commands
----------------

[](#artisan-commands)

### `notifier:install`

[](#notifierinstall)

Interactive wizard that writes the three required environment variables to your `.env` file.

```
php artisan notifier:install

# Overwrite existing values
php artisan notifier:install --force
```

### `notifier:check`

[](#notifiercheck)

Validates the full environment and system requirements. Checks:

- `NOTIFIER_BACKUP_CODE`, `NOTIFIER_URL`, `NOTIFIER_BACKUP_PASSWORD` are set
- Database connection is healthy
- `storage/app/public` is accessible
- `mysqldump` is available on `$PATH`
- ZIP tool is available (`7z` or PHP `zip` extension)
- Logging channel is configured
- Queue connection is set up
- Backup URL is reachable over HTTPS

```
php artisan notifier:check
```

### `notifier:database-backup`

[](#notifierdatabase-backup)

Creates a `mysqldump` of the application database and uploads it to the central notifier.

```
php artisan notifier:database-backup
```

### `notifier:storage-backup`

[](#notifierstorage-backup)

Archives `storage/app/public` into an encrypted ZIP and uploads it to the central notifier.

```
php artisan notifier:storage-backup
```

---

API Endpoint
------------

[](#api-endpoint)

The package registers a single POST endpoint for triggering backups remotely (e.g. from a central scheduler):

```
POST /{route_prefix}/backup

```

**Authentication:** `X-Notifier-Token` header — must match `NOTIFIER_BACKUP_CODE`.
**Rate limit:** 10 requests per 60 seconds.

### Request

[](#request)

ParameterTypeRequiredValues`type`string✓`backup_database`, `backup_storage`### Examples

[](#examples)

```
# Trigger a database backup
curl -X POST https://your-app.com/api/notifier/backup \
  -H "X-Notifier-Token: your-secret-token" \
  -d "type=backup_database"

# Trigger a storage backup
curl -X POST https://your-app.com/api/notifier/backup \
  -H "X-Notifier-Token: your-secret-token" \
  -d "type=backup_storage"
```

### Response

[](#response)

**Success (synchronous):**

```
{
    "success": true,
    "message": "Database backup completed successfully.",
    "backup_type": "database",
    "duration_seconds": 12.34,
    "timestamp": "2025-01-15T10:30:45+00:00"
}
```

**Success (queued):**

```
{
    "success": true,
    "message": "Backup job dispatched to queue.",
    "backup_type": "storage",
    "queued": true,
    "timestamp": "2025-01-15T10:30:45+00:00"
}
```

**Error:**

```
{
    "success": false,
    "message": "Database backup failed.",
    "backup_type": "database",
    "error": "mysqldump: command not found",
    "timestamp": "2025-01-15T10:30:45+00:00"
}
```

---

ZIP Strategy
------------

[](#zip-strategy)

Storage backups use AES-256 encryption regardless of the strategy chosen.

StrategyToolMemory usageBest for`auto` *(default)*7z if available, else ZipArchive—All environments`cli`7z (`p7zip-full`)Low — separate processProduction servers`php`PHP `ZipArchive`Higher — PHP heapEnvironments without 7zInstall `7z` for best performance on Linux servers:

```
sudo apt install p7zip-full
```

---

Queue Support
-------------

[](#queue-support)

By default, API-triggered backups run synchronously inside the HTTP request. For large backups this may hit PHP's `max_execution_time`. Set `NOTIFIER_QUEUE_CONNECTION` to any async queue driver to offload backup jobs:

```
NOTIFIER_QUEUE_CONNECTION=database   # requires php artisan queue:table
NOTIFIER_QUEUE_CONNECTION=redis      # requires phpredis or predis
```

> **Note:** Artisan commands (`notifier:database-backup`, `notifier:storage-backup`) always run synchronously and are not affected by this setting.

---

Programmatic Usage
------------------

[](#programmatic-usage)

The services can be resolved from the container or injected directly:

```
use Devuni\Notifier\Services\NotifierDatabaseService;
use Devuni\Notifier\Services\NotifierStorageService;

$db = app(NotifierDatabaseService::class);
$storage = app(NotifierStorageService::class);

// Database backup
$path = $db->createDatabaseBackup();
$db->sendDatabaseBackup($path);

// Storage backup
$path = $storage->createStorageBackup();
$storage->sendStorageBackup($path);
```

---

Testing
-------

[](#testing)

This package uses [Pest](https://pestphp.com) for testing.

```
composer test            # Run all tests
composer test-unit       # Unit tests only
composer test-feature    # Feature tests only
composer test-coverage   # Tests with coverage report
```

### Test Structure

[](#test-structure)

```
tests/
├── Unit/
│   ├── Commands/         # Artisan command tests
│   ├── Controllers/      # API controller tests
│   ├── Services/         # Service class tests
│   └── NotifierServiceProviderTest.php
└── Feature/
    ├── BackupWorkflowTest.php
    ├── NotifierPackageTest.php
    └── PackageInstallationTest.php

```

---

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Ludwig Tomas](https://github.com/ludwigtomas)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance88

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 59.7% 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 ~4 days

Total

58

Last Release

54d ago

Major Versions

v1.0.27 → v2.0.02026-01-26

### Community

Maintainers

![](https://www.gravatar.com/avatar/b3329e5cc7ef8a31198f98f9039c18ab577edbea4ea23a08326d33f1671a9502?d=identicon)[ludwigtomas](/maintainers/ludwigtomas)

---

Top Contributors

[![ludwigtomas](https://avatars.githubusercontent.com/u/44323251?v=4)](https://github.com/ludwigtomas "ludwigtomas (71 commits)")[![DavidJanec](https://avatars.githubusercontent.com/u/172018795?v=4)](https://github.com/DavidJanec "DavidJanec (42 commits)")[![Braincode-sro](https://avatars.githubusercontent.com/u/258863615?v=4)](https://github.com/Braincode-sro "Braincode-sro (5 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

laravelbackupnotifiernotificationsdevuni

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/devuni-notifier-package/health.svg)

```
[![Health](https://phpackages.com/badges/devuni-notifier-package/health.svg)](https://phpackages.com/packages/devuni-notifier-package)
```

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laravel/boost

Laravel Boost accelerates AI-assisted development by providing the essential context and structure that AI needs to generate high-quality, Laravel-specific code.

3.4k10.6M274](/packages/laravel-boost)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k25.9M107](/packages/laravel-cashier)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

71510.9M66](/packages/laravel-mcp)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)

PHPackages © 2026

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