PHPackages                             mepsd/laravel-google-chat-logger - 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. mepsd/laravel-google-chat-logger

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

mepsd/laravel-google-chat-logger
================================

Send Laravel application logs to Google Chat with rich formatting, emoji support, and context data

v1.0.4(1y ago)1312[1 PRs](https://github.com/mepsd/laravel-google-space-logger/pulls)MITPHPPHP ^8.1CI passing

Since Feb 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mepsd/laravel-google-space-logger)[ Packagist](https://packagist.org/packages/mepsd/laravel-google-chat-logger)[ RSS](/packages/mepsd-laravel-google-chat-logger/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (6)Versions (8)Used By (0)

Laravel Google Chat Logger 🚀
============================

[](#laravel-google-chat-logger-)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9550260fb9bb0ec472c41a2ce4a4a5ee9574c188a674d7ee067af3a2dfbf4cd5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d657073642f6c61726176656c2d676f6f676c652d636861742d6c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mepsd/laravel-google-chat-logger)[![Total Downloads](https://camo.githubusercontent.com/018ba80fae64e92fe40d58eb64650f1a87173d48a2f4b4b67797883f2b1c5e8d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d657073642f6c61726176656c2d676f6f676c652d636861742d6c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mepsd/laravel-google-chat-logger)[![License](https://camo.githubusercontent.com/9d76774a70db9307c539cdc00e30e574ec2d2b868b8b030a63d9f5e71effe332/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d657073642f6c61726176656c2d676f6f676c652d636861742d6c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mepsd/laravel-google-chat-logger)

Send your Laravel application logs directly to Google Chat with rich formatting, emoji support, threading, and automatic retries.

Features 🌟
----------

[](#features-)

- 🎯 **Easy Integration**: Works with Laravel's built-in logging system
- 🧵 **Message Threading**: Group related logs into threads
- 🎨 **Rich Formatting**: Messages are beautifully formatted in Google Chat
- 🔄 **Automatic Retries**: Built-in retry mechanism for failed messages
- 🎯 **Level-based Emojis**: Different emojis for different log levels
- 🌍 **Environment Aware**: Includes environment information in logs
- ⚡ **Performance**: Configurable timeouts and retry settings
- 🚨 **Exception Handling**: Detailed exception formatting with stack traces

Requirements 📋
--------------

[](#requirements-)

- PHP 8.1 or higher
- Laravel 10.x or 11.x
- Google Chat space with webhook access

Installation 💿
--------------

[](#installation-)

1. Install the package via composer:

```
composer require mepsd/laravel-google-chat-logger
```

2. Add these variables to your `.env` file:

```
LOG_CHANNEL=google_chat
GOOGLE_CHAT_WEBHOOK_URL=your-webhook-url
```

3. Add this to your `config/logging.php` channels array:

```
'channels' => [
    'google_chat' => [
        'driver' => 'custom',
        'via' => Mepsd\LaravelGoogleChatLogger\GoogleChatLogger::class,
        'url' => env('GOOGLE_CHAT_WEBHOOK_URL'),
        'level' => env('LOG_LEVEL', 'debug'),
        'retries' => 2,        // Number of retry attempts
        'timeout' => 5,        // Request timeout in seconds
    ],
],
```

Usage 📝
-------

[](#usage-)

### Basic Logging

[](#basic-logging)

```
// Simple info message
Log::info('User registered successfully', ['user_id' => 1]);

// Error with exception
try {
    // Some code
} catch (Exception $e) {
    Log::error('Process failed', [
        'exception' => $e,
        'user_id' => 1
    ]);
}
```

### Message Threading

[](#message-threading)

Group related logs into threads:

```
// Order Processing Thread
$threadKey = 'order-' . $orderId;

Log::info('Order received', [
    'thread_key' => $threadKey,
    'order_id' => $orderId,
    'amount' => 99.99
]);

Log::info('Processing payment', [
    'thread_key' => $threadKey,
    'payment_method' => 'credit_card'
]);

Log::info('Order completed', [
    'thread_key' => $threadKey,
    'status' => 'completed'
]);

// User Activity Thread
$userThread = 'user-' . $userId;

Log::info('User logged in', [
    'thread_key' => $userThread,
    'ip' => $request->ip()
]);

Log::warning('Failed login attempt', [
    'thread_key' => $userThread,
    'attempts' => 3
]);
```

### Exception Handling

[](#exception-handling)

Exceptions are automatically formatted with details:

```
try {
    // Your code
} catch (Exception $e) {
    Log::error('Process failed', [
        'thread_key' => 'process-123',
        'exception' => $e,
        'additional_data' => $data
    ]);
}
```

### Log Levels and Emojis

[](#log-levels-and-emojis)

Each log level has its own emoji:

- 🚨 EMERGENCY - System is unusable
- ⚠️ ALERT - Action must be taken immediately
- 🔥 CRITICAL - Critical conditions
- ❌ ERROR - Error conditions
- ⚠️ WARNING - Warning conditions
- 📝 NOTICE - Normal but significant conditions
- ℹ️ INFO - Informational messages
- 🐛 DEBUG - Debug-level messages

### Message Format

[](#message-format)

Messages in Google Chat will look like:

```
[local] ℹ️ *INFO*

```

Your message here

Context: { "user\_id": 123, "action": "login" }

```

## Configuration Options

Full configuration options:

```php
'google_chat' => [
    'driver' => 'custom',
    'via' => Mepsd\LaravelGoogleChatLogger\GoogleChatLogger::class,
    'url' => env('GOOGLE_CHAT_WEBHOOK_URL'),
    'level' => env('LOG_LEVEL', 'debug'),
    'retries' => 2,              // Number of retry attempts
    'timeout' => 5,              // Request timeout in seconds
],

```

Setting Up Google Chat Webhook 🔗
--------------------------------

[](#setting-up-google-chat-webhook-)

1. Open your Google Chat space
2. Click the space name to open the dropdown menu
3. Select "Manage webhooks"
4. Click "Add webhook"
5. Name your webhook (e.g., "Laravel Logs")
6. Copy the webhook URL
7. Add the URL to your `.env` file

Best Practices 🎯
----------------

[](#best-practices-)

1. Use meaningful thread keys:

```
'user-{id}'        // For user activities
'order-{id}'       // For order processing
'deploy-{date}'    // For deployments
'job-{id}'         // For background jobs
```

2. Group related logs:

```
$threadKey = 'payment-' . $paymentId;
Log::info('Starting payment', ['thread_key' => $threadKey]);
Log::info('Processing', ['thread_key' => $threadKey]);
Log::info('Completed', ['thread_key' => $threadKey]);
```

3. Include context data:

```
Log::info('User action', [
    'thread_key' => 'user-123',
    'action' => 'profile_update',
    'changes' => ['name' => 'New Name'],
    'ip' => $request->ip()
]);
```

Testing 🧪
---------

[](#testing-)

```
composer test
```

Security 🔒
----------

[](#security-)

If you discover any security-related issues, please use the issue tracker.

Credits 👏
---------

[](#credits-)

- [Paras Suthar Darji](https://github.com/mepsd)
- [All Contributors](../../contributors)

License 📄
---------

[](#license-)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance43

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

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

Every ~0 days

Total

5

Last Release

450d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2d208c2df0bb5813d6d4d2286ef5e000d3666020e5e3548879616781b1113588?d=identicon)[mepsd](/maintainers/mepsd)

---

Top Contributors

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

---

Tags

laravelloggingnotificationsloggerwebhookmonologGoogle-Chat

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mepsd-laravel-google-chat-logger/health.svg)

```
[![Health](https://phpackages.com/badges/mepsd-laravel-google-chat-logger/health.svg)](https://phpackages.com/packages/mepsd-laravel-google-chat-logger)
```

###  Alternatives

[marvinlabs/laravel-discord-logger

Logging to a discord channel in Laravel

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

Logging and Notifications for Laravel Console Commands.

8674.9k](/packages/illuminated-console-logger)[naoray/laravel-github-monolog

Log driver to store logs as github issues

10619.4k](/packages/naoray-laravel-github-monolog)[shaffe/laravel-mail-log-channel

A package to support logging via email in Laravel

1286.2k](/packages/shaffe-laravel-mail-log-channel)[yzen.dev/mono-processor

This Processor will display in the logs bread crumbs by which you can more quickly and accurately identify the cause of the error.

116.1k](/packages/yzendev-mono-processor)

PHPackages © 2026

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