PHPackages                             logelse/laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. logelse/laravel

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

logelse/laravel
===============

Laravel log handler for LogElse API

v1.0.0(11mo ago)01Apache-2.0PHPPHP ^7.4|^8.0

Since Jun 18Pushed 11mo agoCompare

[ Source](https://github.com/logelse/laravel)[ Packagist](https://packagist.org/packages/logelse/laravel)[ RSS](/packages/logelse-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

LogElse Laravel SDK
===================

[](#logelse-laravel-sdk)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6e5c3e88b4fe406094bce3e938ade8688f4d3515843c2d96e5dd656b49d20c59/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6f67656c73652f6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/logelse/laravel)[![Apache 2.0 Licensed](https://camo.githubusercontent.com/f9a2da5664498a2a168a000b85719b4e5a61b6df8aae02cca978ef2580f8b1dc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d417061636865253230322e302d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

A Laravel package for seamlessly sending application logs to the LogElse API service. This package integrates with Laravel's logging system to provide real-time log monitoring and analysis.

Features
--------

[](#features)

- 🚀 **Easy Integration** - Seamlessly integrates with Laravel's logging system
- 🔧 **Flexible Configuration** - Environment-based configuration with sensible defaults
- 📊 **Multiple Usage Patterns** - Use as default logger, dedicated channel, or in logging stacks
- 🛡️ **Error Resilient** - Graceful handling of API failures without affecting your application
- 🔄 **Context Sanitization** - Automatically handles complex data types and sensitive information
- ⚡ **Simple Performance** - Direct (synchronous) logging for reliable log delivery

Requirements
------------

[](#requirements)

- **PHP**: ^7.4 | ^8.0 | ^8.1 | ^8.2
- **Laravel**: ^8.0 | ^9.0 | ^10.0 | ^11.0
- **Guzzle HTTP**: ^7.0

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require logelse/laravel
```

The package will automatically register its service provider thanks to Laravel's package auto-discovery.

Configuration
-------------

[](#configuration)

### 1. Publish Configuration File

[](#1-publish-configuration-file)

Publish the configuration file to customize settings:

```
php artisan vendor:publish --provider="LogElse\LogElseServiceProvider" --tag="config"
```

This creates a `config/logelse.php` file in your application.

### 2. Environment Variables

[](#2-environment-variables)

Configure the package by adding these environment variables to your `.env` file:

```
# Required: Your LogElse API key
LOGELSE_API_KEY=your-api-key-here

# The LogElse API URL is hardcoded to https://ingst.logelse.com/logs

# Optional: Custom application name (uses APP_NAME if not specified)
LOGELSE_APP_NAME=MyAwesomeApp
```

### 3. Configure Direct Mode

[](#3-configure-direct-mode)

The package uses direct mode for logging:

```
LOGELSE_DIRECT_TIMEOUT=5
LOGELSE_DIRECT_CONNECT_TIMEOUT=2
```

### 4. Configure Application UUID

[](#4-configure-application-uuid)

Set your application's unique identifier:

```
LOGELSE_APP_UUID=your-app-uuid
```

If not specified, it defaults to 'TEST-1'.

### 5. Configure Logging Channel

[](#5-configure-logging-channel)

Add the LogElse channel to your `config/logging.php` file:

```
'channels' => [
    // ... other channels

    'logelse' => [
        'driver' => 'logelse',
        'level' => env('LOG_LEVEL', 'debug'),
        // Optional: Override global config for this channel
        // 'mode' => 'queue', // Override mode for this channel
        // 'api_key' => 'channel-specific-key',
        // 'api_url' => 'https://custom-url.com/logs',
        // 'app_name' => 'ChannelSpecificApp',
    ],

    // ... other channels
],
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

Use LogElse as a specific logging channel:

```
use Illuminate\Support\Facades\Log;

// Log with context
Log::channel('logelse')->info('User logged in', [
    'user_id' => 123,
    'ip_address' => '192.168.1.1',
    'user_agent' => 'Mozilla/5.0...'
]);

// Different log levels
Log::channel('logelse')->debug('Debug information');
Log::channel('logelse')->warning('Something might be wrong');
Log::channel('logelse')->error('An error occurred', ['error' => $exception->getMessage()]);
Log::channel('logelse')->critical('Critical system failure');
```

### Using as Default Channel

[](#using-as-default-channel)

Set LogElse as your default logging channel:

```
LOG_CHANNEL=logelse
```

Then use the Log facade directly:

```
Log::info('This goes to LogElse by default');
Log::error('Error message', ['context' => 'additional data']);
```

### Using in a Logging Stack

[](#using-in-a-logging-stack)

Combine LogElse with other logging channels:

```
'channels' => [
    'stack' => [
        'driver' => 'stack',
        'channels' => ['single', 'logelse'],
        'ignore_exceptions' => false,
    ],
],
```

### Advanced Usage Examples

[](#advanced-usage-examples)

```
// Log with rich context
Log::channel('logelse')->info('Order processed', [
    'order_id' => $order->id,
    'customer' => [
        'id' => $customer->id,
        'email' => $customer->email,
    ],
    'items_count' => $order->items->count(),
    'total_amount' => $order->total,
]);

// Log exceptions with context
try {
    // Some risky operation
    $result = $service->performOperation();
} catch (Exception $e) {
    Log::channel('logelse')->error('Operation failed', [
        'exception' => $e->getMessage(),
        'trace' => $e->getTraceAsString(),
        'operation' => 'performOperation',
        'user_id' => auth()->id(),
    ]);

    throw $e;
}

// Log performance metrics
$startTime = microtime(true);
// ... some operation
$endTime = microtime(true);

Log::channel('logelse')->info('Performance metric', [
    'operation' => 'database_query',
    'duration_ms' => round(($endTime - $startTime) * 1000, 2),
    'query_type' => 'SELECT',
]);
```

Log Format
----------

[](#log-format)

The package sends logs to the LogElse API in the following structured JSON format:

```
{
    "timestamp": "2024-01-15T10:30:45Z",
    "log_level": "INFO",
    "message": "User logged in successfully",
    "app_name": "MyLaravelApp",
    "app_uuid": "TEST-1"
}
```

Configuration Reference
-----------------------

[](#configuration-reference)

The `config/logelse.php` file contains the following options:

```
return [
    // LogElse API key for authentication
    'api_key' => env('LOGELSE_API_KEY', 'your-default-key'),

    // LogElse API endpoint URL (hardcoded)
    'api_url' => 'https://ingst.logelse.com/logs',

    // Application name for log identification
    'app_name' => env('LOGELSE_APP_NAME', env('APP_NAME', 'Laravel')),

    // Application UUID for log identification
    'app_uuid' => env('LOGELSE_APP_UUID', 'TEST-1'),

    // Logging mode (only direct mode is supported)
    'mode' => 'direct',

    // Direct mode configuration
    'direct' => [
        'timeout' => env('LOGELSE_DIRECT_TIMEOUT', 5),
        'connect_timeout' => env('LOGELSE_DIRECT_CONNECT_TIMEOUT', 2),
    ],
];
```

Error Handling
--------------

[](#error-handling)

The package is designed to be resilient and will not cause your application to fail if the LogElse API is unavailable. Failed log transmissions are silently ignored to ensure your application continues to function normally.

For debugging connection issues, you can temporarily enable Laravel's debug mode and check the logs for any Guzzle HTTP exceptions.

Testing
-------

[](#testing)

To test the integration in your development environment:

```
// In a controller or artisan command
Log::channel('logelse')->info('Test log from ' . config('app.name'), [
    'environment' => app()->environment(),
    'timestamp' => now()->toISOString(),
    'test' => true,
]);
```

Compatibility
-------------

[](#compatibility)

Laravel VersionPHP VersionPackage Version8.x7.4, 8.0+^1.09.x8.0+^1.010.x8.1+^1.011.x8.2+^1.0Troubleshooting
---------------

[](#troubleshooting)

### Common Issues

[](#common-issues)

**1. Logs not appearing in LogElse**

- Verify your API key is correct
- Check that the API URL is accessible
- Ensure the log level is appropriate

**2. Configuration not loading**

- Run `php artisan config:cache` after making changes
- Verify environment variables are set correctly

**3. Performance concerns**

- Direct mode blocks requests until HTTP call completes
- Failed requests are handled gracefully without crashing your app

### Debug Mode

[](#debug-mode)

To enable verbose logging for debugging:

```
// Temporarily add to a service provider or controller
Log::channel('logelse')->debug('Debug test', [
    'config' => config('logelse'),
    'environment' => app()->environment(),
]);
```

Contributing
------------

[](#contributing)

We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.

### Development Setup

[](#development-setup)

1. Clone the repository
2. Install dependencies: `composer install`
3. Run tests: `composer test`
4. Check code style: `composer cs-check`

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

License
-------

[](#license)

The Apache License 2.0. Please see [License File](LICENSE) for more information.

Support
-------

[](#support)

- 📧 **Email**:
- 📖 **Documentation**:
- 🐛 **Issues**: [GitHub Issues](https://github.com/logelse/laravel/issues)

---

Made with ❤️ by the LogElse team

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance52

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

334d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/80b42bc458072f718de1cf39abb22b9c1c856f57ca37f74befe12b9c8580748b?d=identicon)[traxmb](/maintainers/traxmb)

---

Top Contributors

[![mstfbysl](https://avatars.githubusercontent.com/u/89032872?v=4)](https://github.com/mstfbysl "mstfbysl (9 commits)")

### Embed Badge

![Health badge](/badges/logelse-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/logelse-laravel/health.svg)](https://phpackages.com/packages/logelse-laravel)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

86910.0M83](/packages/spatie-laravel-health)[marvinlabs/laravel-discord-logger

Logging to a discord channel in Laravel

2081.1M2](/packages/marvinlabs-laravel-discord-logger)[larabug/larabug

Laravel 6.x/7.x/8.x/9.x/10.x/11.x/12.x/13.x bug notifier

299549.3k1](/packages/larabug-larabug)[shaffe/laravel-mail-log-channel

A package to support logging via email in Laravel

1286.2k](/packages/shaffe-laravel-mail-log-channel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
