alexjose / audit-log
记录审计事件
v2.0.4
2022-05-11 16:01 UTC
Requires
- php: ^7.2|^8.0
- monolog/monolog: ^2.3
Requires (Dev)
- phpunit/phpunit: ^8.5
README
AuditLog - 使用Monolog记录审计事件
此库旨在记录应用程序中发生的关键更改。它跟踪更改和事件来源。
安装
composer require alexjose/audit-log
基本用法
$auditLog = new AuditLog(); $auditLog->log([ 'New User Registerd', 'User', 'creation', 1, 'user', 'alex@example.com', [ 'username' => 'john', 'email' => 'john@example.com' ], null, 1, 'user', 'alex@example.com', ]);
log()
的签名
log()
将接受Event
实例或包含Event
属性数组的对象。
/** * @param Event|array $event */ public function log($event): void
new Event()
的签名
/** * @param string $message The title of the log * @param string $event The unique name of event * @param string $entityId The id of the entity which got modified * @param string $entityType The type to entity which got modified * @param string $entityTitle The title of the entity which got modified * @param array $newValues The new values of the entity * @param array|null $oldValues The old values of the entity * @param string $userId The id of the user who made the change * @param string $userType The type of the user who made the change * @param string $username The username of the user who made the change */ public function __construct( $message, $module, $event, $entityId, $entityType, $entityTitle, $newValues, $oldValues, $userId, $userType, $username ):void