Download the PHP package digitaldev-lx/log-hole without Composer

On this page you can find all versions of the php package digitaldev-lx/log-hole. 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 log-hole

laravel-eupago-repo-banner

Laravel LogHole

LogHole is a modern, flexible Laravel logging package with multi-driver database support. Designed for seamless integration with Laravel's Log facade, it provides a web dashboard for browsing logs, an Artisan command for CLI access, and PHP 8.4+ attributes for declarative method-level logging.

Latest version GitHub license


Features


Requirements

Release PHP Laravel
4.x >= 8.4 13.x
3.x >= 8.4 11.x, 12.x
2.x >= 8.2 10.x, 11.x
1.x >= 8.2 10.x

Supported databases: MySQL, MariaDB, PostgreSQL, SQLite, SQL Server


Installation

Install the package via Composer:

Publish the configuration file:

Run the migration to create the logs_hole table:


Configuration

After publishing, the configuration file is located at config/log-hole.php:

Setting up the log channel

Add the LogHole database channel to your config/logging.php:

Then set the channel as your default (or use it alongside other channels):

Option A - Set as default channel in .env:

Option B - Use as part of a stack:

Option C - Log to the database channel on demand:

Using a different database connection

If you want logs stored in a different database, set the environment variable:

Make sure the connection is defined in config/database.php and the migration has run on that connection.

Caching dashboard stats

On a logs table with millions of rows, the per-level COUNT(*) query that powers the dashboard's stats bar is expensive. With dashboard auto-refresh on, it runs every 5 seconds per visitor.

To cache the stats query, set a positive TTL:

The driver uses Laravel's default cache store under the key log-hole:stats:{connection}:{table}.


Usage

Logging via the Log facade

All standard log levels are supported: emergency, alert, critical, error, warning, notice, info, debug.


PHP Attributes

LogHole provides the #[Loggable] PHP attribute for declarative logging on controller methods and classes. When the LogHole middleware is active, annotated actions are automatically logged after the request is handled.

Setup the middleware

In bootstrap/app.php:

Older Laravel setups (10.x with app/Http/Kernel.php) are supported by LogHole ^2.0. v3 and v4 expect the Laravel 11+ middleware bootstrap layout.

Method-level attribute

Class-level attribute

Apply the attribute to the class to log all controller actions:

Method-level attributes take precedence over class-level attributes.

Attribute options

Parameter Type Default Description
message string '' Custom log message. If empty, uses "{method} was called"
level LogLevel\|string LogLevel::Info Log level (enum or string like 'error')
includeRequest bool false Include request method, URL, and IP in context
channel ?string null Target a specific log channel (null = default)

Using the LogLevel enum


Dashboard

The LogHole dashboard provides a modern web interface for browsing and filtering logs.

URL: /log-hole (configurable via dashboard_route in config)

Features

Restricting dashboard access

By default, the dashboard is open to everyone. To restrict access, add authorized emails to the config:

When the list is not empty, only authenticated users with matching emails can access the dashboard. Unauthenticated users or users not in the list will receive a 403 error.

Gate authorization

LogHole also registers a viewLogHole Gate that you can use in your own authorization logic:


Artisan Command

The log-hole:tail command allows you to query and purge logs directly from the CLI.

Options

Option Description
--emergency Filter by EMERGENCY level
--alert Filter by ALERT level
--critical Filter by CRITICAL level
--error Filter by ERROR level
--warning Filter by WARNING level
--notice Filter by NOTICE level
--info Filter by INFO level
--debug Filter by DEBUG level
--from= Start date filter (e.g., 2024-10-01)
--to= End date filter (e.g., 2024-10-31)
--take= Limit the number of entries (default: 10, clamped 1-1000)
--purge Purge all logs (asks for confirmation)

If no level option is specified, all levels are returned.

Examples

Fetch the last 10 logs (default):

Fetch error-level logs from a date range:

Fetch the last 5 critical logs:

Purge all logs (with confirmation prompt):

Output

The command displays logs in a table with the following columns:

Context is displayed as pretty-printed JSON for readability.


Driver Architecture

LogHole uses the Strategy Pattern for database access. All drivers implement LogDriverInterface:

The DriverFactory auto-detects your database driver and returns the appropriate implementation:

Database Driver Class Context search strategy
MySQL MySqlDriver CAST(context AS CHAR) LIKE ? ESCAPE ?
MariaDB MariaDbDriver Inherits MySQL strategy. Auto-detected via PDO version string, or matched by the explicit mariadb driver name
PostgreSQL PostgreSqlDriver context::text ILIKE ? ESCAPE ? (case-insensitive Unicode)
SQLite SqliteDriver IFNULL(context, '') LIKE ? ESCAPE ?
SQL Server SqlServerDriver CAST(context AS NVARCHAR(MAX)) LIKE ? ESCAPE ?

All drivers use ~ as the LIKE escape character — chosen for portability across MySQL/Postgres/SQLite/SQL Server string-literal handling. User-facing search semantics are unchanged: %, _, and ~ typed into the search box are matched literally.

The driver is registered as a singleton in the service container. You can resolve it directly:

The chunkSize argument on purge() lets you delete in batches instead of one statement — recommended on multi-million-row tables to reduce lock contention and binlog volume. Pass 0 (default) for a single DELETE statement.


Database Table

The migration creates a logs_hole table (configurable via config('log-hole.database.table')) with the following structure:

Column Type Notes
id bigint Primary key, auto-increment
message text Log message
level string Log level (e.g., ERROR)
context json Nullable, additional context
logged_at datetime Nullable, when the log was created

Indexes: logged_at, and a composite (level, logged_at) that also covers level-only filters via leftmost-prefix.


Upgrading

v3.x → v4.0

v4 is a Laravel 13 release with no public API breaks. The driver layer was overhauled internally to fix LIKE wildcard escaping bugs in PostgreSQL and SQL Server, and to unify search semantics across MySQL/MariaDB. If you only used the Log facade, the dashboard, the log-hole:tail command or #[Loggable], the upgrade is composer require digitaldev-lx/log-hole:^4.0.

If you implemented a custom driver against LogDriverInterface, note that purge() now accepts a third optional argument int $chunkSize = 0. Existing callers continue to work; the new argument has a backward-compatible default.

v1.x → v2.0

  1. Config file structure changed — re-publish the config:

  2. Publish tag renamed — changed from --tag=logs-config to --tag=log-hole-config (Spatie convention)

  3. #[Loggable] attribute — the level property is now a LogLevel enum (string values still work for backward compatibility). The $level public property was removed in favor of $logLevel (readonly LogLevel enum).

  4. Views and routes moved — views moved from src/resources/views/ to resources/views/. Routes moved from src/routes/ to routes/. If you published views, re-publish them.

  5. Migration indexes — re-run migrations to add the new performance indexes:

What's new in v4.0

See CHANGELOG.md for the full list.


Testing

To run the integration suite against a real Postgres or MySQL database (skipped by default), set LOG_HOLE_INTEGRATION_DB:

CI runs this suite automatically against Postgres 16 and MySQL 8.4 services.


License

digitaldev-lx/log-hole is open-sourced software licensed under the MIT license.

About DigitalDev

DigitalDev is a web development agency based in Lisbon, Portugal. We specialize in Laravel, Livewire, and Tailwind CSS.

Codeboys is our special partner and we work together to deliver the best solutions for our clients.


All versions of log-hole with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
illuminate/contracts Version ^13.0
spatie/laravel-package-tools Version ^1.93||^2.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 digitaldev-lx/log-hole contains the following files

Loading the files please wait ...