Download the PHP package uzapoint/auditable without Composer

On this page you can find all versions of the php package uzapoint/auditable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package auditable

Uzapoint Auditable

Distributed audit logging for Laravel microservices. The package publishes audit events from each service to RabbitMQ and includes helpers for Eloquent model auditing, manual audit logs, user context resolution, OpenTelemetry trace correlation, and fallback storage when publishing fails.

Requirements

Installation

Install the package in every microservice that should publish audit events:

The package depends on uzapoint/eventbus-core, which provides the RabbitMQ publisher and consumer command.

If Laravel package discovery is not available, register the service providers manually in config/app.php:

Configure RabbitMQ

AuditPublisher publishes to the RabbitMQ topic exchange audit.events with the routing key audit.events. The event bus reads RabbitMQ connection values from config('queue.connections.rabbitmq'), so add a RabbitMQ connection to config/queue.php in each publishing service:

Add the matching environment variables:

Configure Auditing

The package merges config/auditable.php by default. To customize config and publish the fallback migration into an application, run:

This publishes:

You can also publish each asset type separately:

Set the service identity in .env. These values are added to every published audit payload so the central audit service can identify the source service.

Important config values:

Use events => ['*'] to publish every supported event. Sensitive fields are recursively replaced with ***REDACTED*** inside changes and properties.

Enable Model Auditing

Add the Auditable trait to any Eloquent model that should publish audit events.

The trait publishes:

Each event includes the subject type, subject id, causer context, old/new changes, service metadata, host, timestamp, optional batch UUID, and current OpenTelemetry trace/span ids.

Manual Audit Logs

Use the facade when you need to audit an action that is not tied directly to an Eloquent lifecycle event:

You can also inject Uzapoint\Auditable\Services\AuditPublisher and call publish(array $payload) directly when you already have the full audit payload.

User Context

UserContextResolver resolves the causer in this order:

  1. Gateway headers and request input
  2. Request body values
  3. Context set for a queued job or consumed message
  4. auth('api')->user()
  5. A system context

For HTTP requests through an API gateway, pass these values when available:

The resolver also reads user_id, person, terminal_id, and terminal_information from the request body.

For queued jobs or message handlers, set the user context before changing audited models:

To pass context into a new message, include:

Batch Correlation

Use BatchContext when a workflow changes several models and you want all audit events to share a single batch id:

The batch UUID is added to meta.batch_uuid on every audit payload published while the context is active.

Fallback Storage

When RabbitMQ publishing fails, the publisher can insert the payload into a local fallback table for retry. Publish the migration and run migrations:

The table defaults to failed_audit_events and stores the JSON payload, failure time, retry time, attempts, processed time, and error text.

Central Audit Service Consumer

In the central audit service, consume the audit.events exchange and route messages to ProcessAuditEvents.

Publish the event bus config:

Configure config/eventbus.php:

Run the consumer:

ProcessAuditEvents inserts records into config('auditable.table', 'activity_logs'). Make sure the central audit service has a compatible activity_logs table or set auditable.table to the table name you want to use.

The expected columns are:

Typical Microservice Setup Checklist

  1. Install uzapoint/auditable.
  2. Add the RabbitMQ connection to config/queue.php.
  3. Set AUDIT_SERVICE_NAME, AUDIT_SERVICE_ENV, and RabbitMQ environment variables.
  4. Run php artisan vendor:publish --tag=auditable to publish package config and fallback migration.
  5. Run php artisan migrate if local failed-publish storage is required.
  6. Add Uzapoint\Auditable\Traits\Auditable to each model that should publish audit events.
  7. Forward gateway user headers or set UserContextResolver in queued/message workflows.
  8. Run the central audit service consumer for the audit.events queue.

Troubleshooting


All versions of auditable with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
illuminate/support Version ^11.0|^12.0|^13.0
illuminate/database Version ^11.0|^12.0|^13.0
uzapoint/eventbus-core Version ^1.0
open-telemetry/sdk Version ^1.15
symfony/http-client Version ^8.1
nyholm/psr7 Version ^1.8
open-telemetry/api Version ^1.10
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package uzapoint/auditable contains the following files

Loading the files please wait ...