devuni / notifier-package
Laravel package for automated backups and notifications.
Requires
- php: ^8.4
- guzzlehttp/guzzle: ^7.9
- illuminate/support: ^12.2
Requires (Dev)
- larastan/larastan: ^3.6.1
- laravel/pint: ^1.24.0
- mockery/mockery: ^1.6.12
- orchestra/testbench: ^10.6.0
- pestphp/pest: ^4.0.4
- dev-main
- v1.0.24
- v1.0.23
- v1.0.22
- v1.0.21
- v1.0.20
- v1.0.19
- v1.0.18
- v1.0.17
- v1.0.16
- v1.0.15
- v1.0.14
- v1.0.13
- v1.0.12
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v1.0.0-beta.2
- v1.0.0-beta.1
- v1.0.0-alpha.3
- v1.0.0-alpha.2
- v1.0.0-alpha.1
- dev-codex/review-project-for-improvement-suggestions
This package is auto-updated.
Last update: 2025-09-21 19:42:32 UTC
README
A Laravel 12 package for automated database backups and notifications.
Features
- Automated database backups with mysqldump
- Automated storage backups with ZIP compression
- Secure backup uploads to remote servers
- Password-protected ZIP archives
- File exclusion configuration
- REST API for remote backup triggers
- Comprehensive logging and error handling
- Easy configuration and customization
Requirements
- PHP ^8.4
- Laravel ^12.2
Installation
You can install the package via composer:
composer require devuni/notifier-package
Publish the configuration file:
php artisan vendor:publish --provider="Devuni\Notifier\NotifierServiceProvider" --tag="config"
Configure environment variables for Notifier package:
php artisan notifier:install
Configuration
The configuration file will be published to config/notifier.php
. Here you can configure:
- Backup authentication codes and URLs
- ZIP archive passwords
- File exclusion patterns
- Remote server endpoints
Usage
Basic Usage
use Devuni\Notifier\Services\NotifierDatabaseService; use Devuni\Notifier\Services\NotifierStorageService; // Create a database backup $databaseBackupPath = NotifierDatabaseService::createDatabaseBackup(); NotifierDatabaseService::sendDatabaseBackup($databaseBackupPath); // Create a storage backup $storageBackupPath = NotifierStorageService::createStorageBackup(); NotifierStorageService::sendStorageBackup($storageBackupPath);
Artisan Commands
Create a database backup:
php artisan notifier:database-backup
Create a storage backup:
php artisan notifier:storage-backup
Install and configure the package:
php artisan notifier:install
API Endpoints
The package provides a REST API endpoint for triggering backups remotely:
# Trigger database backup GET /api/backup?param=backup_database # Trigger storage backup GET /api/backup?param=backup_storage
Note: The API endpoint includes rate limiting (5 requests per minute) and requires proper environment configuration.
Configuration Options
// config/notifier.php return [ 'backup_code' => env('BACKUP_CODE') ?: env('NOTIFIER_BACKUP_CODE'), 'backup_url' => env('BACKUP_URL') ?: env('NOTIFIER_URL'), 'backup_zip_password' => env('BACKUP_ZIP_PASSWORD') ?: env('NOTIFIER_BACKUP_PASSWORD', 'secret123'), /* |-------------------------------------------------------------------------- | Excluded Files |-------------------------------------------------------------------------- | | Here you may specify a list of files or files in directories that should be | excluded from the backup process. Any file path that | matches an entry in this array will not be copied into storage | or included inside the generated ZIP archive. | | Examples: | '.gitignore' -> exclude the .gitignore file | 'public\text.txt' -> exclude a specific file inside public folder */ 'excluded_files' => [ '.gitignore', ] ];
Environment Variables
The package requires the following environment variables to be configured:
# Required for backup authentication and upload BACKUP_CODE=your-secret-backup-code BACKUP_URL=https://your-backup-server.com/upload # Required for ZIP encryption (fallback: 'secret123') BACKUP_ZIP_PASSWORD=your-zip-password # Alternative environment variable names (fallbacks) NOTIFIER_BACKUP_CODE=alternative-backup-code NOTIFIER_URL=alternative-backup-url NOTIFIER_BACKUP_PASSWORD=alternative-zip-password
Use the install command to set these up interactively:
php artisan notifier:install
Testing
This package uses Pest for testing, providing a beautiful and expressive testing experience with comprehensive test coverage.
Test Suite
The package includes:
- Unit Tests: Service classes, commands, controllers, and configuration
- Feature Tests: Integration testing and end-to-end workflows
- Mocking Support: Complex scenarios with external dependencies
# Run all tests composer test # Run only unit tests composer test-unit # Run only feature tests composer test-feature # Run tests with coverage composer test-coverage
Test Structure
tests/
├── Unit/
│ ├── Services/ # Service class testing
│ ├── Commands/ # Artisan command testing
│ ├── Controllers/ # API controller testing
│ └── NotifierServiceProviderTest.php
└── Feature/
├── NotifierPackageTest.php # Core integration tests
├── PackageInstallationTest.php # Installation testing
└── BackupWorkflowTest.php # End-to-end workflows
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.