grazulex/laravel-snapshot 问题修复 & 功能扩展

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

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

grazulex/laravel-snapshot

Composer 安装命令:

composer require grazulex/laravel-snapshot

包简介

A powerful Laravel package for tracking, storing and comparing snapshots of your Eloquent models — cleanly and safely.

README 文档

README

Laravel Snapshot

Advanced model versioning and snapshot system for Laravel applications

Latest Version Total Downloads License PHP Version Laravel Version Tests Code Style

Overview

Laravel Snapshot is a powerful package for tracking, storing and comparing snapshots of your Eloquent models — cleanly and safely. Perfect for audit trails, data recovery, debugging, and version control of your Laravel applications.

✨ Features

  • Manual & Automatic Snapshots - Capture model state on demand or automatically
  • 🔄 Model Restoration - Restore models to any previous snapshot state
  • 📊 Smart Comparisons - Deep diff analysis between snapshots
  • 💾 Multiple Storage Backends - Database, file system, or in-memory storage
  • 📈 Rich Analytics - Statistics, change frequency, and trend analysis
  • CLI Commands - Full command-line interface for all operations
  • 🧪 Testing Support - Built with Pest 3 and extensive test coverage
  • Production Ready - PHPStan level 5, optimized performance

� Quick Installation

# Install the package
composer require grazulex/laravel-snapshot

# Publish config (optional)
php artisan vendor:publish --tag=snapshot-config

# Run migrations
php artisan migrate

� Documentation

All documentation, examples, and guides are now available in our comprehensive Wiki:

📚 Visit the Laravel Snapshot Wiki →

Quick Navigation:

Topic Link
🏁 Getting Started Installation & Setup
📘 Basic Usage Creating & Managing Snapshots
⚙️ Configuration Configuration Options
🔄 Model Restoration Restoring Previous States
📊 Analytics & Reports Statistics & Analytics
CLI Commands Command Reference
💡 Examples Real-world Examples
🧪 Testing Testing Your Implementation
🔧 Advanced Usage Advanced Features
🚀 API Reference Complete API Documentation

💡 Quick Example

use Grazulex\LaravelSnapshot\Traits\HasSnapshots;

class Order extends Model
{
    use HasSnapshots;
}

// Create snapshots
$order = Order::find(1);
$order->snapshot('before-discount');

$order->update(['total' => 99.99]);
$order->snapshot('after-discount');

// Compare and restore
$diff = $order->compareWithSnapshot('before-discount');
$order->restoreFromSnapshot('before-discount');

// CLI usage
php artisan snapshot:save "App\Models\Order" --id=1 --label=backup
php artisan snapshot:restore "App\Models\Order" 1 backup
php artisan snapshot:diff before-discount after-discount

🎯 Use Cases

Perfect for:

  • Financial Systems - Transaction history and audit trails
  • Content Management - Version control for articles and pages
  • E-commerce - Product and order change tracking
  • Data Recovery - Point-in-time data restoration
  • Compliance - Regulatory audit trail requirements
  • Debugging - Track state changes during development

🔧 Requirements

  • PHP: ^8.3
  • Laravel: ^12.19
  • Carbon: ^3.10

🧪 Quality Assurance

  • 95 Tests passing with Pest 3
  • PHPStan Level 5 compliance
  • 60%+ Code Coverage
  • Laravel Pint code style
  • Comprehensive CLI testing

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Commands

composer run-script full    # Run all quality checks
composer run-script test    # Run tests
composer run-script pint    # Fix code style
composer run-script phpstan # Static analysis

🔒 Security

If you discover a security vulnerability, please review our Security Policy.

📄 License

Laravel Snapshot is open-sourced software licensed under the MIT license.

📚 Complete Documentation | 💬 Discussions | � Issues

Made with ❤️ for the Laravel community

grazulex/laravel-snapshot 适用场景与选型建议

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

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

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

围绕 grazulex/laravel-snapshot 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 10
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-19