承接 cbytedigital/nen7513-audit-logging 相关项目开发

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

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

cbytedigital/nen7513-audit-logging

Composer 安装命令:

composer require cbytedigital/nen7513-audit-logging

包简介

NEN 7513-compliant Laravel package for audit logging

README 文档

README

PHP from Packagist Latest Version on Packagist Software License Total Downloads

A comprehensive NEN 7513-compliant Laravel package for audit logging, designed specifically for healthcare applications and other environments requiring detailed activity tracking and compliance with Dutch healthcare standards.

This package automatically tracks and logs all user interactions with your Laravel application's data, capturing who, what, when, where, why, and how for complete audit traceability.

Key Features

  • NEN 7513 Compliant - Meets Dutch healthcare logging standards
  • Automatic Logging - Zero-configuration CRUD operation tracking
  • Flexible API - Multiple ways to log: automatic, facade, or trait methods
  • Rich CREATE Logging - Configurable full model data logging on creation
  • Parent-Child Logging - Child model changes automatically log on parent with full context
  • Data Privacy - Automatic masking of sensitive fields
  • Smart Actor Detection - Automatically identifies users, guests, or system processes
  • Retention Management - Configurable cleanup with NEN 7513 compliance
  • Advanced Querying - Powerful filtering and search capabilities
  • Web Dashboard - Beautiful, responsive audit log viewer with export functionality

Installation

Use composer to install this package:

composer require cbytedigital/nen7513-audit-logging

Publish and run the migration:

php artisan vendor:publish --tag=audit-log
php artisan migrate

Quick Start

Add the Auditable trait to any model you want to track:

<?php

use CbyteDigital\Nen7513AuditLogging\Traits\Auditable;
use Illuminate\Database\Eloquent\Model;

class Patient extends Model
{
    use Auditable;
    
    public function getAuditName(): string
    {
        return $this->first_name . ' ' . $this->last_name;
    }
}

That's it! All CRUD operations are now automatically logged:

$patient = Patient::create(['name' => 'John Doe']);     // Logged
$patient->update(['name' => 'John Smith']);             // Logged
$patient->delete();                                     // Logged

Usage Examples

Automatic Logging

// All operations automatically logged with the Auditable trait
$patient = Patient::find(1);
$patient->update(['status' => 'discharged']);

Manual Logging with Facade

use CbyteDigital\Nen7513AuditLogging\Facades\AuditLog;

AuditLog::read($patient, 'Patient medical record accessed');
AuditLog::failed('Unauthorized access attempt')
    ->forActor($user)
    ->read($patient);

Parent-Child Logging

// Child model changes automatically logged on parent
class ClientHistory extends Model 
{
    use ParentAuditable;
    
    protected static function getParentAuditConfig(): array
    {
        return [
            'parent_relation' => 'client',
            'actions' => ['create', 'update', 'delete'],
        ];
    }
}

Documentation

Support

Version Laravel Version PHP Version
1.x ^11.0|^12.0 ^8.2

Testing

Run the tests with:

composer test
# or
php vendor/bin/phpunit

Postcardware

This package is completely free to use. If it makes it to your production environment we would highly appreciate you sending us a postcard from your hometown! 👏🏼

Our address is: CBYTE Digital B.V., Parallelweg 27, 5223AL 's-Hertogenbosch, Netherlands.

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-08-20