承接 ratoguras/laravel-migrate-backup 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

ratoguras/laravel-migrate-backup

最新稳定版本:v1.0.2

Composer 安装命令:

composer require ratoguras/laravel-migrate-backup

包简介

Automatically takes a database backup before running migrate:fresh or migrate:refresh

README 文档

README

Automatically create a database backup before running destructive migration commands like migrate:fresh and migrate:refresh.

This package ensures your data is always safe by generating a timestamped SQL dump before migrations execute.

✨ Features

  • 🔄 Auto backup before migrate:fresh
  • 🔄 Auto backup before migrate:refresh
  • 🏷️ Timestamped backup files
  • 📂 Custom backup directory support
  • 🧩 Works with migration flags (--seed, etc.)
  • 🐬 MySQL / MariaDB support
  • 🐘 PostgreSQL support
  • 📦 SQLite file backup
  • ⚡ Laravel Auto-Discovery ready
  • 🛠️ Laravel 10 / 11 / 12 compatible

📦 Installation

Install via Composer:

composer require ratoguras/laravel-migrate-backup

⚙️ Publish Configuration

php artisan vendor:publish --tag=migrate-backup-config

This will publish:

config/migrate-backup.php

🧾 Configuration

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Commands to Watch
    |--------------------------------------------------------------------------
    |
    | Backups will run before these artisan commands execute.
    |
    */

    'commands' => [
        'migrate:fresh',
        'migrate:refresh',
    ],

    /*
    |--------------------------------------------------------------------------
    | Backup Path
    |--------------------------------------------------------------------------
    |
    | Relative to project base path.
    |
    */

    'path' => 'database/backups',

];

🚀 Usage

Run migrations as usual:

php artisan migrate:fresh

or

php artisan migrate:fresh --seed

or

php artisan migrate:refresh

Before execution, the package will automatically generate a backup.

📂 Backup Location

database/backups/

Example file:

mydatabase_2026-02-13_18-45-10.sql

🗄️ Supported Databases

Database Supported
MySQL
MariaDB
PostgreSQL
SQLite

🧠 How It Works

The package listens to Laravel’s console event:

Illuminate\Console\Events\CommandStarting

When a configured migration command is detected, it:

  1. Detects default DB connection
  2. Creates backup directory (if missing)
  3. Generates timestamped dump
  4. Stores SQL file safely

📋 Requirements

  • PHP ≥ 8.2
  • Laravel ≥ 10.x

🧪 Testing Backup

Run:

php artisan migrate:fresh

You should see:

✅ Database backup created: yourdb_2026-02-13_18-50-22.sql

🔐 Security Note

Backups may contain sensitive data.

Recommended:

  • Add /database/backups to .gitignore
  • Store backups securely in production

🛣️ Roadmap

Planned features:

  • 🔁 Backup restore command
  • 🗜️ ZIP compression
  • 🧹 Auto cleanup scheduler
  • ☁️ Cloud backup support
  • 🪟 Windows dump compatibility

🤝 Contributing

Contributions are welcome!

  1. Fork the repo
  2. Create feature branch
  3. Commit changes
  4. Submit PR

🐞 Issues

Report bugs or request features:

👉 https://github.com/Packages-Rato-Guras/laravel-migrate-backup/issues

📄 License

MIT License © 2026 Adish Dahal

👨‍💻 Author

Adish Dahal Founder & CEO — Rato Guras Technology Pvt. Ltd.

⭐ Support

If you find this package useful, please ⭐ the repository and share it with the Laravel community.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固