drewlabs/changelog 问题修复 & 功能扩展

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

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

drewlabs/changelog

最新稳定版本:v0.1.2

Composer 安装命令:

composer require drewlabs/changelog

包简介

Library declaring classes and contracts for handling database table attributes changes

README 文档

README

The table changelog library provides an abstract implementation of table row changes in application database. It should be use to track columns changes in sql database and centralize the logs in project defined storage.

Usage

The library provide simply APIs for registering and logging changes in your project. To register a driver that can be used to log changes:

<?php

// ...
use Drewlabs\Changelog\Logger;
// ...
// At the root of your application or when your application bootstraps

Logger::getInstance()->registerDriver(new MyLogger);

// or using a factory function
Logger::getInstance()->registerDriver(function() {
    return MyLogger
}, 'myLog');

Note Logger is a singleton instance that register loggers globally in your application, and should be use with care if one does not want to share state.

After registering your logger in the global handler, you can log any table changes by calling the logChange method of the global logger:

// In some part of the code where we need to log table column changes
Logger::getInstance()->logChange('table_name', 'model_key', 'property_name', 'old_value', 'current_value', 'logged_by');

Note Take a look at a driver implementation compatible with laravel eloquent library and php-amqplib/php-amqplib compatible implementation for message queues.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-03-01