定制 isemary/backup-sentry 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

isemary/backup-sentry

Composer 安装命令:

composer require isemary/backup-sentry

包简介

BackupSentry is a PHP backup package designed to provide a secure and seamless solution for protecting and backup your critical data. With its advanced features and intuitive interface, Effortlessly create scheduled backups of databases, files, and directories.

README 文档

README

BackupSentry is a PHP backup package designed to provide a secure and seamless solution for protecting and backup your critical data. With its advanced features and intuitive interface, Effortlessly create scheduled backups of databases, files, and directories.

Features

☁️ Store backup files over Google Drive / AWS
✅ Database Backup [Sql/NoSQL]
📂 Full Project Backup Or Specific Folders
⛔ Exclude Specific Folders / Files
🎛 Detailed Configuration Easy to use
🗄️ Up-to-date Log file with each process
🚨 Alerts on Mail, Slack, and Telegram


Flow Overview

alt text


Installation

Install the package

composer require isemary/backup-sentry:v1.0.11

Publish the configuration file

For Laravel > 5.4

php artisan backup-sentry:publish

For Laravel < 5.4

php artisan vendor:publish --provider="iSemary\BackupSentry\BackupSentryServiceProvider"

Configuration

It's important to make sure that config file exists in your root directory as [config/BackupSentry.php]

./config/BackupSentry.php

<?php

return [
    'backup' => [
        // The compressed file password, leave empty if the default value is same as env key : BACKUP_SENTRY_ZIP_PASSWORD
        'compressed_password' => '',
        // to backup the database tables
        'database' => [
            'allow' => true,
            'connection' => '',
            'host' => '',
            'port' => '',
            'name' => '',
            'username' => '',
            'password' => '',
        ],
        // upload backup file into cloud services 
        'cloud_services' => [
            'google_drive' => [
                'allow' => false,
                'folder_id' => '', // leave empty if the default value is same as env key : GOOGLE_DRIVE_BACKUP_FOLDER_ID
                'client_id' => '', // leave empty if the default value is same as env key : GOOGLE_DRIVE_CLIENT_ID
                'refresh_token' => '', // leave empty if the default value is same as env key : GOOGLE_DRIVE_REFRESH_TOKEN
                'client_secret' => '', // leave empty if the default value is same as env key : GOOGLE_DRIVE_CLIENT_SECRET
            ],
            'aws' => [
                'allow' => false,
                'access_key' => '', // leave empty if the default value is same as env key : AWS_ACCESS_KEY_ID
                'secret_key' => '', // leave empty if the default value is same as env key : AWS_SECRET_ACCESS_KEY
                'bucket_name' => '', // leave empty if the default value is same as env key : AWS_BUCKET
                'region' => '', // leave empty if the default value is same as env key : AWS_DEFAULT_REGION
            ]
        ],
        // Main email that will get emails about backup whatever it is success or failure 
        // [you could add cc on each type of emails in the options below]
        'mail' => [
            'allow' => false,
            'to' => ['to@example.com']
        ],
        // enable sending alert emails
        'email_alert' => false,
        'channels' => [
            // enable sending alert via slack channels
            'slack' => [
                'allow' => true,
                'webhook_url' => '' // you can create a new app on slack OR leave empty if the default value is same as env key : SLACK_WEBHOOK_URL
            ],
            // enable sending alert via telegram bots
            'telegram' => [
                'allow' => false,
                'bot_token' => '', // you can create a new bot on telegram OR leave empty if the default value is same as env key : TELEGRAM_BOT_TOKEN
                'chat_ids' => [] // array of chat ids of your users ** [Telegram not sending messages by phone number]
            ]
        ],
        // to backup the complete project files
        'full_project' => true,
        // to backup the storage folder only
        'storage_only' => true,
        // location of project storage
        'storage_path' => "storage/",
        // to backup specific folders or files
        'specific_folders_or_files' => [
            'tests',
            '.env'
            // 'app/folder1',
            // 'app/file.txt',
        ],
        // to exclude specific files/folders
        'excludes' => [
            '.git',
            'vendor',
            'node_modules',
        ],
        // that's mean the original back up folders will be kept in "/storage/backup-sentry/files/" [Which will be kept uncompressed]
        'keep_original_backup_folders' => true,
        // cleanup
        'cleanup' => false
    ],
    'options' => [
        // put the emails to be alerted with the successful backup notification
        'alert_successful_backup_email_to' => ['first_email@example.com', 'second_email@example.com'],
        // put the emails to be alerted with the failure backup notification
        'alert_failure_backup_email_to' => ['developer@example.com', 'devops@example.com'],
        // encryption type for the compressed file
        'encryption' => 'EM_AES_256',
    ]
];

Example on PHP Native

<?php

require 'vendor/autoload.php';

use iSemary\BackupSentry\BackupSentry;

(new BackupSentry)->run();

?>

Example on Laravel

use iSemary\BackupSentry\BackupSentry;

Route::get('/backup', function() {
    (new BackupSentry)->run();
});

🔑 Default Environment Keys Required For :

File Compress

BACKUP_SENTRY_ZIP_PASSWORD=###

Database Backup

DB_CONNECTION=###
DB_HOST=###
DB_PORT=###
DB_DATABASE=###
DB_USERNAME=###
DB_PASSWORD=###

Google Drive Backup

GOOGLE_DRIVE_CLIENT_ID=###
GOOGLE_DRIVE_CLIENT_SECRET=###
GOOGLE_DRIVE_REFRESH_TOKEN=###
GOOGLE_DRIVE_BACKUP_FOLDER_ID=###

AWS Backup

AWS_ACCESS_KEY_ID=###
AWS_SECRET_ACCESS_KEY=###
AWS_DEFAULT_REGION=###
AWS_BUCKET=###

Sending Email Alerts

MAIL_DRIVER=###
MAIL_HOST=###
MAIL_PORT=###
MAIL_USERNAME=###
MAIL_PASSWORD=###
MAIL_ENCRYPTION=###
MAIL_FROM_ADDRESS=###
MAIL_FROM_NAME=###

Slack Alert

SLACK_WEBHOOK_URL=###

Telegram Alert

TELEGRAM_BOT_TOKEN=###

Contact

For any inquiries or support, please email me at abdelrahmansamirmostafa@gmail.com or visit my website at abdelrahman.online.

isemary/backup-sentry 适用场景与选型建议

isemary/backup-sentry 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 86 次下载、GitHub Stars 达 9, 最近一次更新时间为 2023 年 07 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「backup」 「database-backup」 「google-drive-backup」 「php-backup」 「laravel-backup-package」 「backup-one-line」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 isemary/backup-sentry 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 isemary/backup-sentry 我们能提供哪些服务?
定制开发 / 二次开发

基于 isemary/backup-sentry 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 86
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 20
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-07-10