PHPackages                             adriceci/audit-center - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. adriceci/audit-center

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

adriceci/audit-center
=====================

A comprehensive Laravel package for audit logging with Vue.js frontend components

v1.0.6(6mo ago)017MITPHPPHP ^8.2

Since Oct 31Pushed 6mo agoCompare

[ Source](https://github.com/adriceci/audit-center)[ Packagist](https://packagist.org/packages/adriceci/audit-center)[ RSS](/packages/adriceci-audit-center/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (8)Used By (0)

Audit Center
============

[](#audit-center)

A comprehensive Laravel package for audit logging with Vue.js frontend components.

Features
--------

[](#features)

- 🎯 Automatic audit logging for API requests
- 📊 Comprehensive audit log management
- 📈 Statistics and analytics dashboard
- 🎨 Beautiful Vue.js frontend components
- ⚙️ Highly configurable
- 🔒 Secure by default (sensitive fields excluded)
- 📱 Responsive design with dark mode support

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require adriceci/audit-center
```

Or add it manually to your `composer.json`:

```
{
  "require": {
    "adriceci/audit-center": "^1.0"
  },
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/adriceci/audit-center"
    }
  ]
}
```

Configuration
-------------

[](#configuration)

### Publishing Configuration and Migrations

[](#publishing-configuration-and-migrations)

```
php artisan vendor:publish --provider="AdriCeci\AuditCenter\Providers\AuditCenterServiceProvider"
```

This will publish:

- `config/audit-center.php` - Package configuration
- Database migrations to `database/migrations/`

### Running Migrations

[](#running-migrations)

```
php artisan migrate
```

### Configuration File

[](#configuration-file)

After publishing, you can configure the package in `config/audit-center.php`:

```
return [
    // User model class
    'user_model' => \App\Models\User::class,

    // Route configuration
    'routes' => [
        // Note: The ServiceProvider automatically adds 'api' prefix, so use 'audit-logs' not 'api/audit-logs'
        'prefix' => 'audit-logs',
        'middleware' => ['auth:sanctum', 'admin'],
    ],

    // Middleware configuration
    'middleware' => [
        'api_prefix' => 'api',
        'logged_methods' => ['POST', 'PUT', 'PATCH', 'DELETE'],
        'excluded_routes' => [
            'api/audit-logs*',
            'api/user',
            'api/login',
            'api/register',
            'api/logout',
        ],
        'sensitive_fields' => [
            'password',
            'password_confirmation',
            'token',
            'api_token',
        ],
        'auto_register' => false, // Set to true for automatic middleware registration
    ],

    // Frontend configuration
    'frontend' => [
        'route' => '/audit-logs',
        // Note: Since ApiService typically has baseURL '/api', use 'audit-logs' not '/api/audit-logs'
        'api_prefix' => 'audit-logs',
    ],
];
```

Usage
-----

[](#usage)

### Middleware Registration

[](#middleware-registration)

The package can automatically register the audit logging middleware, or you can register it manually:

#### Option 1: Auto-register (Recommended for Laravel 11+)

[](#option-1-auto-register-recommended-for-laravel-11)

In `config/audit-center.php`, set:

```
'middleware' => [
    'auto_register' => true,
],
```

#### Option 2: Manual Registration

[](#option-2-manual-registration)

In `bootstrap/app.php` (Laravel 11+):

```
use AdriCeci\AuditCenter\Http\Middleware\AuditLogMiddleware;

->withMiddleware(function (Middleware $middleware) {
    $middleware->api(append: [
        AuditLogMiddleware::class,
    ]);
})
```

Or in `app/Http/Kernel.php` (Laravel 10):

```
protected $middlewareGroups = [
    'api' => [
        // ... other middleware
        \AdriCeci\AuditCenter\Http\Middleware\AuditLogMiddleware::class,
    ],
];
```

### Manual Audit Logging

[](#manual-audit-logging)

You can manually create audit log entries in your controllers:

```
use AdriCeci\AuditCenter\Models\AuditLog;

AuditLog::log(
    action: 'login',
    description: 'User logged in successfully',
    userId: auth()->id(),
);
```

### Vue.js Components

[](#vuejs-components)

#### Publishing Vue Assets

[](#publishing-vue-assets)

```
php artisan vendor:publish --tag=audit-center-vue-source
```

This will publish the Vue components to `resources/js/vendor/audit-center/`.

#### Configuring Vue Components

[](#configuring-vue-components)

In your Vue application, configure the API service:

```
// In your main.js or app.js
// Note: Use 'audit-logs' (without leading /) if your ApiService has baseURL '/api'
// The composable will automatically handle the prefix correctly
window.auditCenterConfig = {
  apiPrefix: "audit-logs", // Without leading '/' to use ApiService's baseURL
  apiService: ApiService, // Your API service instance
};
```

#### Using the Component

[](#using-the-component)

In your router or component:

```
import AuditLogs from '@/vendor/audit-center/components/AuditLogs.vue';

// In your router
{
    path: '/audit-logs',
    name: 'audit-logs',
    component: AuditLogs,
}
```

Or use the composable directly:

```
import { useAuditLogs } from "@/vendor/audit-center/composables/useAuditLogs";

const { auditLogs, fetchAuditLogs, loading } = useAuditLogs();
```

API Endpoints
-------------

[](#api-endpoints)

The package provides the following API endpoints:

- `GET /api/audit-logs` - List audit logs (with filtering and pagination)
- `GET /api/audit-logs/{id}` - Get a specific audit log
- `GET /api/audit-logs/stats` - Get audit log statistics
- `POST /api/audit-logs` - Create an audit log (manual)
- `PUT /api/audit-logs/{id}` - Update an audit log (manual)
- `DELETE /api/audit-logs/{id}` - Delete an audit log (soft delete)

### Query Parameters

[](#query-parameters)

For `GET /api/audit-logs`:

- `action` - Filter by action type
- `user_id` - Filter by user ID
- `from_date` - Filter from date (YYYY-MM-DD)
- `to_date` - Filter to date (YYYY-MM-DD)
- `per_page` - Items per page (default: 15)
- `page` - Page number

Frontend Requirements
---------------------

[](#frontend-requirements)

The Vue components expect:

- Vue 3
- A Table component from `@/components/ui` (or adjust imports)
- An API service compatible with the expected interface (see `useAuditLogs.js`)

Customization
-------------

[](#customization)

### Custom User Model

[](#custom-user-model)

If you use a different User model:

```
// config/audit-center.php
'user_model' => \App\Models\CustomUser::class,
```

### Custom Route Prefix

[](#custom-route-prefix)

```
// config/audit-center.php
// Note: Don't include 'api/' prefix as the ServiceProvider adds it automatically
'routes' => [
    'prefix' => 'admin/audit-logs', // Results in /api/admin/audit-logs
],
```

### Excluding Routes

[](#excluding-routes)

Add routes to exclude from automatic logging:

```
'middleware' => [
    'excluded_routes' => [
        'api/audit-logs*',
        'api/custom-route*',
    ],
],
```

Requirements
------------

[](#requirements)

- PHP &gt;= 8.2
- Laravel &gt;= 12.0
- Vue 3 (for frontend components)

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

License
-------

[](#license)

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

Support
-------

[](#support)

For issues and questions, please open an issue on [GitHub](https://github.com/adriceci/audit-center).

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance67

Regular maintenance activity

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

7

Last Release

191d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/91bdbe66e6daedf1d955514d751ebbe6519d38da2cfda2f9edcbc60d111f730c?d=identicon)[adriceci](/maintainers/adriceci)

---

Top Contributors

[![adriceci-fr](https://avatars.githubusercontent.com/u/240585299?v=4)](https://github.com/adriceci-fr "adriceci-fr (9 commits)")

---

Tags

laravellogginglaravel-packageAuditvueactivity-logaudit-log

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/adriceci-audit-center/health.svg)

```
[![Health](https://phpackages.com/badges/adriceci-audit-center/health.svg)](https://phpackages.com/packages/adriceci-audit-center)
```

###  Alternatives

[muhammadsadeeq/laravel-activitylog-ui

A beautiful, modern UI for Spatie's Activity Log with advanced filtering, analytics, and real-time features.

17510.1k](/packages/muhammadsadeeq-laravel-activitylog-ui)[noxoua/filament-activity-log

A Laravel package that simplifies activity logging in the Filament admin panel, with support for logging create, update, delete, and restore actions. It integrates with the 'spatie/laravel-activitylog' package and includes a modernized activity log viewing page.

7151.5k](/packages/noxoua-filament-activity-log)[alizharb/filament-activity-log

A powerful, feature-rich activity logging solution for FilamentPHP v4 &amp; v5 with timeline views, dashboard widgets, and revert actions.

2326.6k](/packages/alizharb-filament-activity-log)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
