mahedulhasan/audit-logger
Composer 安装命令:
composer require mahedulhasan/audit-logger
包简介
Laravel Audit Logging Package
关键字:
README 文档
README
A simple Laravel Audit Logging Package to track database changes on your models.
Tracks create, update, delete events and stores only the changed fields in audit_logs table.
Features
- Logs
created,updated, anddeletedevents automatically - Only stores changed fields (
old_values&new_values) on updates - Tracks which user made the changes
- Stores client IP address
- Dynamic observer attachment for all or selected models
- Bootstrap-based view to display audit logs
- Easy to integrate as a Laravel package
Requirements
- Laravel 9 / 10
- PHP >= 8.1
- MySQL or any database supported by Laravel
Installation
Require the package via Composer:
composer require mahedulhasan/audit-logger
Make sure your
minimum-stabilityincomposer.jsonallowsdevpackages if needed:
"minimum-stability": "dev", "prefer-stable": true
Run the migrations:
php artisan migrate
(Optional) Publish views/config if you want to customize:
php artisan vendor:publish --provider="MahedulHasan\AuditLogger\AuditLoggerServiceProvider"
Development Version (GitHub)
If you want to use the latest development version, install directly from GitHub:
- Add the VCS repository to your project's composer.json:
"repositories": [ { "type": "vcs", "url": "https://github.com/ripuhasan/audit-logger" } ]
- Require the dev-main branch:
composer require mahedulhasan/audit-logger:dev-main
Usage
Observer
The package automatically attaches AuditObserver to your models.
To attach manually:
use App\Models\User; use MahedulHasan\AuditLogger\Observers\AuditObserver; User::observe(AuditObserver::class);
Display Audit Logs
Visit the route:
/audit-logs
This route displays a Bootstrap table showing:
- User
- Event (Created / Updated / Deleted)
- Model & ID
- Changed fields (old → new)
- IP Address
- Timestamp
Note: The route is automatically registered by the package's ServiceProvider.
Development
- Add new migrations in
database/migrations/ - Add additional observers in
src/Observers/ - Update views in
resources/views/ - Run
composer dump-autoloadif you add new namespaces
Notes
- No local installation needed. The package can be installed directly via Composer.
- Ensure ServiceProvider is registered automatically via
extra.laravel.providersincomposer.json. - Migrations, routes, and views are loaded automatically. You only need to run
php artisan migrate.
License
MIT License © [Mahedul Hasan]
mahedulhasan/audit-logger 适用场景与选型建议
mahedulhasan/audit-logger 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 10 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「logging」 「database」 「admin」 「Audit」 「observer」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mahedulhasan/audit-logger 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mahedulhasan/audit-logger 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mahedulhasan/audit-logger 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dibi is Database Abstraction Library for PHP
Store your language lines in the database, yaml or other sources
2lenet/EasyAdminPlusBundle
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
A Zend Framework module that sets up Monolog for logging in applications.
Analysis module for finding problematical shop data.
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2025-10-23