Download the PHP package ayup-creative/event-log without Composer

On this page you can find all versions of the php package ayup-creative/event-log. 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 event-log

Laravel Event Logger

CI/CD Latest Version on Packagist Total Downloads License

A high-performance, structured, asynchronous, and relational event logging package for Laravel. Designed for auditability, traceability, and cross-service correlation without storing sensitive payload data.

Core Design Goals


Installation

You can install the package via composer:

The service provider will automatically register itself.

You should publish and run the migrations:

You can optionally publish the config file:


Versions

The package follows semantic versioning. Major version changes indicate breaking changes, while minor and patch versions introduce new features and bug fixes, respectively.

Version Laravel
1.x 12.x
2.x 13.x

Configuration

The published config file config/event-log.php allows you to customize the models used by the package:


Usage

1. Manual Domain Events

Use the log_event helper to record significant domain events asynchronously. It is recommended to use the namespaced log_event() function.

Event Enums

The log_event helper also supports BackedEnum for event names, providing better type safety and IDE autocompletion.

2. Automatic Lifecycle Logging

Add the LogsEvents trait to any Eloquent model to automatically log lifecycle events (created, updated, deleted, restored).

Customizing Trait Behavior

You can override these methods in your model:

3. Custom Actor & Causer Resolution

By default, the package uses auth()->id() to identify the current user and determines if the action was triggered by a 'user' (web request) or 'worker' (CLI).

You can customize this behavior using the EventLog Facade in your AppServiceProvider:

4. Grouping Events with Transactions

Use the WithEventTransaction wrapper to group multiple events occurring within a single database transaction. This assigns a shared transaction_id to all events logged inside the closure.

5. Correlation IDs & Middleware

Correlation IDs allow you to trace a logical action across multiple services and background jobs.

Global Middleware

Add the EventCorrelationMiddleware to your global or web/api middleware stack to automatically capture or generate a correlation ID for every request.

Propagation via HTTP Client

The package adds a macro to the Laravel HTTP client to easily propagate the correlation ID:

6. Human-Readable Event Formatting

You can map internal dot-notation event names (e.g., user.created) to human-readable strings (e.g., A new user was created). This is useful for displaying a timeline of events to end-users.

Using the Facade (Closure-based)

Register a formatter in your AppServiceProvider:

Using a Formatter Class (Cache-friendly)

For better performance and to keep your AppServiceProvider clean, you can use a dedicated class. This is also required if you want to use php artisan config:cache, as closures cannot be serialized.

  1. Create your formatter class:

  2. Register it in config/event-log.php:

Accessing the Formatted Description

Once a formatter is registered, you can access the human-readable string via the description attribute on the EventLog model:


Querying Events

You can retrieve a unified timeline of events for any model using the EventLog Facade. This returns events where the model is either the subject or a related model.

Causer Labels

The EventLog model provides a causerLabel() helper to identify the actor:

Metadata Helper

The meta attribute provides a shorthand for the metadata collection, allowing you to access values directly as properties:

Alternatively, you can access the full metadata relationship, which returns an Eloquent collection of metadata models.


Advanced Features

Idempotency

To prevent duplicate logs during queue retries, the package generates a deterministic idempotency_key for every event. If a job runs twice, the database uniqueness constraint will silently prevent the second record from being created.

OpenTelemetry Bridge

If the open-telemetry/opentelemetry package is installed, the logger will automatically create spans for each event. The correlation_id is used to maintain trace context.


Testing

The package includes a comprehensive test suite. To run the tests:

Or manually:

License

The MIT License (MIT).


All versions of event-log with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
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 ayup-creative/event-log contains the following files

Loading the files please wait ...