PHPackages                             swayok/laravel-extended-errors - 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. swayok/laravel-extended-errors

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

swayok/laravel-extended-errors
==============================

Laravel logging extender used to render logs and exceptions as HTML to store to files and/or send via email and telegram

7.0.5(6mo ago)11.3kMITPHPPHP &gt;=8.1CI passing

Since Dec 19Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/swayok/laravel-extended-errors)[ Packagist](https://packagist.org/packages/swayok/laravel-extended-errors)[ RSS](/packages/swayok-laravel-extended-errors/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (3)Versions (29)Used By (0)

What is this
============

[](#what-is-this)

This package provides additional drivers (telegram and email) and log renderers for Laravel logging system. Renderers generate HTML code to be written to log files or sent to external services (slack, email, telegram).

Example of logs: [screenshot\_log.png](https://raw.githubusercontent.com/swayok/laravel_extended_errors/master/screenshot_log.png)

Example of exception log: [screenshot\_exception.png](https://raw.githubusercontent.com/swayok/laravel_extended_errors/master/screenshot_exception.png)

1. Installation
---------------

[](#1-installation)

### Laravel &lt;= 5.5

[](#laravel--55)

Add require to `composer.json` and run `composer update`

```
"require": {
    "swayok/laravel-extended-errors": "5.5.*",
}

```

[Proceed using step 2 in branch laravel\_up\_to\_5.5](https://github.com/swayok/laravel-extended-errors/blob/laravel_up_to_5.5/Readme.md)

### Laravel 5.6+ to Laravel 9

[](#laravel-56-to-laravel-9)

Add require to `composer.json` and run `composer update`

```
"require": {
    "swayok/laravel-extended-errors": ":6.0",
}

```

### Laravel 10+

[](#laravel-10)

Add require to `composer.json` and run `composer update`

```
"require": {
    "swayok/laravel-extended-errors": ":7.0",
}

```

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

[](#configuration)

### Service provider

[](#service-provider)

Automatically added via package auto-discovery.

### Renderers

[](#renderers)

#### HTML renderer injection into `daily` and `single` channel drivers

[](#html-renderer-injection-into-daily-and-single-channel-drivers)

```
'single' => [
    'driver' => 'single',
    'path' => storage_path('logs/laravel.html'),
    'tap' => [\LaravelExtendedErrors\Formatter\HtmlFormatter::class],
    'level' => 'debug',
],

'daily' => [
    'driver' => 'daily',
    'path' => storage_path('logs/laravel.html'),
    'level' => 'debug',
    'days' => 7,
    'tap' => [\LaravelExtendedErrors\Formatter\HtmlFormatter::class],
],

```

### Drivers

[](#drivers)

All changes will be applied to `'channels'` array in `config/logging.php`.

#### Telegram channel

[](#telegram-channel)

```
'telegram' => [
    'driver' => 'telegram',
    'token' => env('LOG_TELEGRAM_API_KEY'),
    'chat_id' => env('LOG_TELEGRAM_CHAT_ID'),
    'proxy' => [
        'type' => env('LOG_TELEGRAM_PROXY_TYPE', 'http'),
        'host' => env('LOG_TELEGRAM_PROXY_HOST'),
        'port' => env('LOG_TELEGRAM_PROXY_PORT'),
        'user' => env('LOG_TELEGRAM_PROXY_USER'),
        'password' => env('LOG_TELEGRAM_PROXY_PASSWORD'),
    ],
    'level' => 'debug',
    'message_prefix' => env('LOG_TELEGRAM_MESSAGE_PREFIX', mb_ucfirst(env('APP_ENV', ''))),
    'bubble' => false',
]

```

Rendered logs and exceptions are sent as documents to provided `chat_id`.

Option `message_prefix` will wrap passed string into `[] ` and add it in front of the message resulting in something like `[Prod] *Error* Something happened.` when `'message_prefix' => "Prod"`and message is `*Error* Something happened.`.

**Proxy settings:**

- `proxy.type` can be: `http`, `socks4`, `socks5`, `nginx`;
- `proxy.user` and `proxy.password` can be empty if proxy has no authorisation;
- `proxy.host` for `http`, `socks4` and `socks5` types usually is an IP address like `192.168.1.1`;
- `proxy.host` for `nginx` type should be a full url like `http://bot.yourdomain.com`,`https://bot.yourdomain.com` or `http://bot.yourdomain.com:8080`;
- `proxy.port` is not used for this type.

Proxy uses Basic Auth method to send user and password. Other auth methods are not supported right now. Make an issue if you need some (make sure CURL supports it).

**Nginx vhost config to proxy requests to api.telegram.org**

```
server {
    listen 80;
    server_name bot.yourdomain.com;
    location / {
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass https://api.telegram.org/;
        client_max_body_size 100M;
    }
}

```

#### Email channel (probably won't work with Laravel 10+)

[](#email-channel-probably-wont-work-with-laravel-10)

```
'email' => [
    'driver' => 'email',
    'level' => 'debug',
    'subject' => 'Server log',
    'sender' => 'local@test.lh',
    'receiver' => ['your@email.com'],
    'bubble' => false',
],

```

**Warning**: there is no limit for exceptions, and you may eventually get thousands of errors at once if you use this channels in high loaded project.

#### Sentry

[](#sentry)

Actually there is no channel driver for Sentry but here is quick tutorial on how to add exceptions reporting to Sentry via Handler.php:

Require sentry packages:

```
"require": {
    "sentry/sentry": "^1.8",
    "sentry/sentry-laravel": "^0.8.0",
}

```

In your `app/Exception/Handler.php` update `report()` method to look like:

```
public function report(Exception $exception) {
    if ($this->shouldReport($exception) && app()->bound('sentry')) {
        app('sentry')->captureException($exception, ['extra' => \LaravelExtendedErrors\Utils::getMoreInformationAboutRequest()]);
    }

    parent::report($exception);
}

```

To `.env` file add url provided by Sentry when you create a new project there. It will look like this:

```
SENTRY_DSN=https://8158bc7a6110...e7b152b@sentry.domain.com/1

```

Note that there is `'extra'` key used to send report to Sentry. This one stores all data from current request just like exception logs generated by HTML Renderer. This provides better understanding of what happened.

#### Whoops exception page replacement

[](#whoops-exception-page-replacement)

To replace HTML exception pages rendered by built-in Laravel's Whoops handler with exception page rendered by this package you need to add `'replace_whoops' => true,` to `config/logging.php`

#### Custom user info data collector

[](#custom-user-info-data-collector)

`ExceptionHtmlRenderer` prints minimal set of user info: primary key and class. To print more info you can provide your own user info collector using `ExceptionHtmlRenderer::setUserInfoCollector(\Closure)`. Closure
receives no arguments and must return null (not authenticated) or array. Also, it is on your side how you get user object. `ExceptionHtmlRenderer` by default uses `request()->user()`;

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance67

Regular maintenance activity

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 92.2% 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 ~112 days

Recently: every ~184 days

Total

26

Last Release

194d ago

Major Versions

5.6.1 → 6.0.12019-10-03

5.6.2 → 6.0.52020-02-22

5.6.4 → 6.0.62020-05-14

6.0.14 → 7.0.02023-03-16

PHP version history (3 changes)5.5.0PHP &gt;=5.6

5.6.0PHP &gt;=7.1.3

7.0.0PHP &gt;=8.1

### Community

Maintainers

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

---

Top Contributors

[![swayok](https://avatars.githubusercontent.com/u/629675?v=4)](https://github.com/swayok "swayok (83 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")[![paanblogger](https://avatars.githubusercontent.com/u/1589496?v=4)](https://github.com/paanblogger "paanblogger (1 commits)")

---

Tags

phplaravelloggingexceptionerrortelegrammonolog

### Embed Badge

![Health badge](/badges/swayok-laravel-extended-errors/health.svg)

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

###  Alternatives

[justbetter/magento2-sentry

Magento 2 Logger for Sentry

1821.4M3](/packages/justbetter-magento2-sentry)[guanguans/laravel-exception-notify

Monitor exception and report to the notification channels(Dump、Log、Mail、AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

14241.9k1](/packages/guanguans-laravel-exception-notify)[thecoder/laravel-monolog-telegram

Telegram Handler for Monolog

2938.6k](/packages/thecoder-laravel-monolog-telegram)[e2ex/e2ex

Converts PHP Errors to Exceptions and (optionally) logs PHP Errors, Notices and Warnings with a PSR-3 compatible logger

101.5k](/packages/e2ex-e2ex)

PHPackages © 2026

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