yassine-as/laravel-s3-db-backup 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

yassine-as/laravel-s3-db-backup

最新稳定版本:v1.0.0

Composer 安装命令:

composer require yassine-as/laravel-s3-db-backup

包简介

Laravel package for database backups to S3 with

README 文档

README

Package for database backups with upload to AWS S3

Installation

  1. Install the package via Composer:
composer require yassine-as/laravel-s3-db-backup
  1. Publish the configuration file:
php artisan s3-db-backup:install
  1. Configure your backup settings:
    • Open config/s3-db-backup.php
    • Set your local backup path, S3 disk, S3 prefix folder, and gzip option.
    • Make sure your AWS S3 credentials and disk are configured in config/s3-db-backup.php and .env

Environment Variables (.env)

Make sure to add the following variables to your .env file for AWS S3 and dump commands paths if needed:

# AWS S3 Configuration (required)
AWS_ACCESS_KEY_ID=your_aws_access_key_id
AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key
AWS_DEFAULT_REGION=your_aws_region
AWS_BUCKET=your_s3_bucket_name

# Optional: Custom path to mysqldump command if not in PATH
DB_DUMP_COMMAND_PATH=/usr/bin/mysqldump

# Optional: Custom path to pg_dump command if using PostgreSQL
PG_DUMP_PATH=/usr/bin/pg_dump

Usage

Run the backup command:

php artisan db:backup-to-s3

Options

  • --connection= Specify the database connection (defaults to your default connection)
  • --local-only Skip uploading the backup to S3 (backup saved locally only)
  • --clean Delete local backup file after successful upload to S3

Example

Backup default database, upload to S3, and delete local file:

php artisan db:backup-to-s3 --clean

Backup MySQL connection only locally (no S3 upload):

php artisan db:backup-to-s3 --connection=mysql --local-only

Requirements

  • PHP 8.0+
  • Laravel 9 or 10
  • AWS S3 configured in Laravel filesystems and .env
  • mysqldump or pg_dump installed and accessible in your server PATH or specified in .env

Notes

  • Backups are compressed with gzip by default.
  • The package supports MySQL and PostgreSQL.
  • Be sure your database user has permission to run dump commands.
  • Keep your AWS credentials secure.

Author

Yassine ait sidi brahim — yassineaitsidibrahim@email.com

Credits

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-25