Download the PHP package maksudur-dev/laravel-logpilot without Composer
On this page you can find all versions of the php package maksudur-dev/laravel-logpilot. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download maksudur-dev/laravel-logpilot
More information about maksudur-dev/laravel-logpilot
Files in maksudur-dev/laravel-logpilot
Package laravel-logpilot
Short Description A lightweight activity logging package for Laravel with request tracing.
License MIT
Homepage https://github.com/maksudur-dev/laravel-logpilot
Informations about the package laravel-logpilot
Laravel LogPilot
A lightweight Laravel activity logging package that improves debugging, tracing, and business-event visibility while using Laravel's EXISTING logging system or a database.
Key Features
- Request Tracing: Group multiple logs under a single
log_idautomatically. - Dual Drivers: Support for Laravel Logs, Database, or both.
- Auto-Context: Automatically captures User ID, IP, URL, and Method.
- Model Support: Easily associate activities with Eloquent models.
- API Support: Optional API endpoints to view activity logs.
- Artisan Commands: Install, prune, and test your setup easily.
- Laravel 8-13 & PHP 8.1+: Compatible with Laravel 8, 9, 10, 11, 12, and 13.
- Lightweight: Zero-config by default, minimal overhead.
Installation
You can install the package via composer:
Run the installation command:
If you are using the database driver, run the migrations:
Updating Package
To update the package to the latest version (v1.0.3):
Or target the version explicitly:
If you are developing locally with a path repository in composer.json, simply run:
Configuration
The configuration file is located at config/logpilot.php.
Usage
1. Global Helper (Quickest)
2. Eloquent Trait (Recommended for Models)
Add the LogsActivity trait to your models:
3. Service Usage
Inject the ActivityLogger service into your classes:
4. Grouping Related Logs (Tracing)
Perfect for complex flows like checkouts or background jobs:
5. Clean Architecture (DTOs, Enums & Services)
LogPilot uses Clean Architecture patterns out-of-the-box. You can leverage Enums, DTOs, and Services in your application:
Enums
ActivityService & DTOs
Encapsulated Model Query Methods
Frontend Integration (Vue/React Example)
Since LogPilot provides an API, you can easily build a "Recent Activity" component.
Example Vue Component
Example React Component
Example Blade Component
If you prefer server-side rendering, you can pass logs to a Blade component:
API Support
LogPilot exposes clean, JSON-ready endpoints with comprehensive search, filtering, and pagination support:
GET /api/activity-logs: List and filter activity logs.GET /api/activity-logs/levels: Get all log levels formatted for frontend select/dropdown inputs.GET /api/activity-logs/trace/{log_id}: Trace a full request lifecycle bylog_id.GET /api/activity-logs/model/{type}/{id}: Activity for a specific resource.
Query Parameters & Filtering (GET /api/activity-logs)
You can pass query parameters to filter, search, and paginate logs:
| Parameter | Type | Description | Example |
|---|---|---|---|
search / q / query |
string |
Search across action, message, url, log_id, ip, and model_type fields. |
?search=Failed |
level |
string |
Filter by log level (case-insensitive: error, warning, info, debug, critical, alert, emergency, notice). Pass all or empty to include all levels. |
?level=Error |
action |
string |
Filter by exact action name. | ?action=USER_LOGIN |
user_id |
mixed |
Filter logs for a specific User ID. | ?user_id=42 |
log_id |
string |
Filter logs by trace ID (log_id). |
?log_id=c2753c6f-6f06-... |
model_type |
string |
Filter logs for a specific model class. | ?model_type=App\Models\User |
model_id |
mixed |
Filter logs for a specific model ID. | ?model_id=5 |
start_date / date_from / from |
date |
Filter logs created on or after date/time. | ?start_date=2026-08-01 |
end_date / date_to / to |
date |
Filter logs created on or before date/time. | ?end_date=2026-08-14 |
per_page |
integer |
Results per page (default: 20, max: 500). |
?per_page=50 |
page |
integer |
Page number for pagination (default: 1). |
?page=2 |
Filtering Example
Artisan Commands
php artisan activity:install: Setup everything.php artisan activity:prune: Cleanup old logs.php artisan activity:test: Verify installation.
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-logpilot with dependencies
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/database Version ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/log Version ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/console Version ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0