Download the PHP package ss-ipg/laravel-auditable without Composer

On this page you can find all versions of the php package ss-ipg/laravel-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 laravel-auditable

Laravel Auditable

Declarative model audit logging for Laravel using PHP attributes.

Overview

Laravel Auditable provides a simple, attribute-based approach to audit logging for Eloquent models. Mark any model with the #[Auditable] attribute and all create, update, and delete events are automatically logged with detailed change tracking.

Features

Requirements

Installation

Publish the configuration file:

Quick Start

1. Configure a log channel

Add an audit channel to config/logging.php:

2. Add the attribute to a model

3. Enable audit logging

In your .env file:

That's it! All changes to the model will now be logged.

Configuration

Note: Set environments to ['*'] to enable audit logging in all environments regardless of APP_ENV.

Attribute Options

The #[Auditable] attribute accepts several options:

Option Type Default Description
columns ?array null Only audit these columns. null = all columns.
exclude array [] Exclude these columns from auditing.
redact array [] Log that column changed, but show [REDACTED] instead of values.
events array All events Which events to audit.
withOriginal bool true Include original values in update logs.

Examples

Log Output

Each audit entry is a JSON object with the following structure:

Default Fields

These fields are automatically included in every audit entry:

Field Source
action The event type (created, updated, deleted, etc.)
context "web" or "cli" based on how the application is running
model The fully-qualified model class name
model_id The model's primary key value
user_id auth()->id() — the authenticated user, or null if unauthenticated
ip request()->ip() — the client IP address
timestamp ISO 8601 formatted timestamp

Changes Structure

The changes field varies by event type:

Soft Delete Detection

When a model uses Laravel's SoftDeletes trait, the package automatically distinguishes between soft deletes and hard deletes:

No configuration is needed—the package detects the SoftDeletes trait automatically.

Cast Normalization

The package respects your model's $casts to prevent false-positive change detection. For example:

This applies to boolean, integer, float, string, array, and json casts.

Context Providers

Context providers allow you to add custom metadata to every audit log entry. Create a class that implements AuditContextProvider:

Register the provider in config/auditable.php:

Custom Formatters

To customize the log output format, create a class that implements AuditFormatter:

Register it in config/auditable.php:

Auditing Pivot Tables

Standard attach(), detach(), and sync() operations bypass Eloquent model events. To audit pivot table changes, use a custom Pivot model:

Then reference it in your relationships:

Testing

The package provides Audit::fake() for testing auditable models without writing to actual log files.

Basic Usage

Available Assertions

Entry Structure

Each captured entry contains:

Known Limitations

License

MIT License. See LICENSE for details.


All versions of laravel-auditable with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/contracts Version ^11.0|^12.0|^13.0
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/log Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
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 ss-ipg/laravel-auditable contains the following files

Loading the files please wait ...