basantsd/db-backup-laravel-ci
Composer 安装命令:
composer require basantsd/db-backup-laravel-ci
包简介
A Laravel and CI package for daily database backups sent via email
README 文档
README
A framework agnostic package to automatically back up your database and send the result via email. It supports both Laravel and CodeIgniter applications.
Features
- Works with MySQL, PostgreSQL, SQL Server and SQLite databases
- Creates a SQL dump and compresses it using
gzip - Emails the compressed dump on a daily schedule
- If the gzipped file exceeds the configured size limit (25 MB by default) it is saved to disk and a download path is emailed instead
Installation
composer require basantsd/db-backup-laravel-ci
Environment variables
Add these entries to your .env file:
BACKUP_EMAIL=your-email@example.com BACKUP_TOKEN=your-secret-token APP_NAME="project-name" # Optional: override the maximum attachment size in bytes (default 26214400) BACKUP_MAX_ATTACHMENT_SIZE=26214400
Laravel setup
- Publish the configuration file:
php artisan vendor:publish --provider="Basantsd\\Backup\\Laravel\\BackupServiceProvider" --tag="config"
- Schedule the command in
app/Console/Kernel.php:protected function schedule(Schedule $schedule) { $schedule->command('backup:daily', ['--token' => config('backup.token')])->daily(); }
CodeIgniter setup
- Add a route to
routes.php:$route['backup/daily'] = 'BackupController/daily';
- Call the route with the token header:
curl -H "X-Backup-Token: your-secret-token" http://your-domain.com/backup/daily
Usage
Laravel
Run the artisan command:
php artisan backup:daily --token=your-secret-token
CodeIgniter
Access the /backup/daily URL with the header shown above.
Handling large backups
Many email providers reject attachments larger than 20–25 MB. When the compressed backup exceeds BACKUP_MAX_ATTACHMENT_SIZE, this package saves the file to a backups directory (storage/app/backups for Laravel or APPPATH/backups for CodeIgniter) and sends an email containing the path to download the backup manually.
License
The MIT License (MIT). Please see the LICENSE file for more information.
basantsd/db-backup-laravel-ci 适用场景与选型建议
basantsd/db-backup-laravel-ci 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.67k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 06 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「database backup」 「daily-backup」 「laravel ci backup」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 basantsd/db-backup-laravel-ci 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 basantsd/db-backup-laravel-ci 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 basantsd/db-backup-laravel-ci 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dibi is Database Abstraction Library for PHP
A SDK for working with B2 cloud storage.
Store your language lines in the database, yaml or other sources
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
A sleek PHP wrapper around rclone with Laravel-style fluent API syntax
A PSR-7 compatible library for making CRUD API endpoints
统计信息
- 总下载量: 1.67k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-06-24