Download the PHP package codebar-ag/laravel-event-logs without Composer

On this page you can find all versions of the php package codebar-ag/laravel-event-logs. 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-event-logs

Laravel Event Logs

Packagist Version Downloads License PHP Version Laravel Version Tests PHPStan Coverage

This package records HTTP requests and model lifecycle events as rows in your database. Configure a dedicated database connection for the event_logs table so logging stays isolated from your primary application data.

Table of Contents

Requirements

Installation

Composer Install

Publish Configuration

This publishes config/laravel-event-logs.php and config/laravel-event-logs-exclude-routes-defaults.php (Nova/Livewire route skip list). Override exclude_routes in the main config file if you need a custom list; you can delete the defaults file from your app if you inline the array.

Publish Migrations (Optional)

If you want to customize the migrations or need them in your application's database/migrations directory, you can publish them:

Note: Migrations are automatically loaded from the package, so publishing is optional. However, if you plan to use the event-logs:schema:create command, it's recommended to publish the migrations first, or the command will automatically publish them for you.

Configuration

Database Connection

By default, the package uses your application's default database connection. You can specify a custom database connection for event logs by setting the connection option in your configuration file:

Or via environment variable:

This is useful when you want to store event logs in a separate database for better performance or isolation.

When enabled is true, EventLog::isEnabled() also requires connection to be a non-empty string. Set EVENT_LOGS_CONNECTION (or the config value) to your connection name; use your app’s default connection name explicitly if you do not use a dedicated logs connection.

Schema Management

The package provides Artisan commands to manage the event logs database schema:

Create Schema

Create the database schema for event logs:

This command will:

Note: The command requires the connection configuration to be set. Migrations are published into your app so the path is under the application root (required by Laravel’s migrator).

Update Schema

Reconcile the live event_logs table with the package definition (columns and indexes in order). Use this when the table already exists but may be missing columns (for example after a partial manual setup or an old install):

This command will:

Converting subject_id on MySQL, PostgreSQL, or SQL Server often needs doctrine/dbal; the package lists it under composer suggest. For apps that only use Laravel’s migration history on a clean database, php artisan migrate is usually enough.

Drop Schema

Drop the database schema for event logs:

Or with the force option (no confirmation):

This command will:

Warning: This will permanently delete all event logs data. Use with caution.

Configuration reference

Published defaults live in config/laravel-event-logs.php. Common keys (see the file for the full list and inline comments):

Area Keys / env
Feature toggle enabled (EVENT_LOGS_ENABLED)
DB connection connection (EVENT_LOGS_CONNECTION) — required when enabled
Writes persist_mode (EVENT_LOGS_PERSIST_MODE: sync or queued), queue.connection, queue.queue
Sanitization sanitize.request_headers_exclude, sanitize.request_data_exclude
Context stored on rows context.enabled, context.allow_keys (comma-separated env EVENT_LOGS_CONTEXT_ALLOW_KEYS), context.max_keys, context.max_json_bytes
HTTP user lookup user_resolution.guards, user_resolution.scan_all_guards
Route skipping exclude_routes (defaults loaded from config/laravel-event-logs-exclude-routes-defaults.php in the package), exclude_routes_match (EVENT_LOGS_EXCLUDE_ROUTES_MATCH: auto default, or exact, wildcard)

Upgrading

The package ships one migration: database/migrations/2026_04_10_000000_create_event_logs_table.php. It creates event_logs with the full current schema (HTTP metrics columns, string subject_id, no Azure-era sync columns). If the table already exists, up() does nothing (safe when upgrading).

If you previously published older package migrations (2025_08_09_*, 2026_04_07_*, 2026_04_08_*), remove those files from your app’s database/migrations and publish again (or copy the new migration only) so you do not duplicate create_event_logs migrations.

HTTP middleware must remain a terminable middleware in the stack (Laravel invokes terminate() automatically when registered via append / the HTTP kernel). If you only call handle() in custom tests, call terminate($request, $response) yourself.

Breaking changes (recent versions)

Usage

Middleware Request Logging

The EventLogMiddleware automatically logs all HTTP requests after the response is available. Add it to your application:

Configuration

Implementation

Logged Data

The middleware logs these HTTP request details:

Optional: set persist_mode to queued and configure queue.connection / queue.queue to write rows via RecordEventLogJob.

Example Output

Model Event Logging

Use the HasEventLogTrait to automatically log model events (created, updated, deleted, restored). Rows are written through the same EventLogRecorder as HTTP logs, so persist_mode (sync or queued) applies here too.

Implementation

Logged Data

The trait automatically logs these events:

Each model event logs:

Example Output

Adding Context

Use Laravel’s Context facade to add data that can be persisted on event_logs rows. What actually gets stored is filtered by the context config (enabled, optional allow_keys, max_keys, max_json_bytes) — see Configuration reference.

For example, set context in middleware that runs before EventLogMiddleware:

Register the context middleware before EventLogMiddleware:


All versions of laravel-event-logs with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/support Version ^13.0
illuminate/queue Version ^13.0
illuminate/console Version ^13.0
illuminate/database Version ^13.0
illuminate/http Version ^13.0
illuminate/pipeline Version ^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 codebar-ag/laravel-event-logs contains the following files

Loading the files please wait ...