PHPackages                             tixelrocks/laravel-safe-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. tixelrocks/laravel-safe-logger

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

tixelrocks/laravel-safe-logger
==============================

A little wrapper for Laravel Logger that prevents it from crashing ever

0.4(11mo ago)15.0kMITPHPPHP &gt;=7.4

Since Jan 12Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/TixelRocks/laravel-safe-logger)[ Packagist](https://packagist.org/packages/tixelrocks/laravel-safe-logger)[ Docs](https://github.com/TixelRocks/laravel-safe-logger)[ RSS](/packages/tixelrocks-laravel-safe-logger/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (3)Dependencies (6)Versions (6)Used By (0)

laravel-safe-logger
===================

[](#laravel-safe-logger)

A safe Laravel logger that will never crash your app

Introduction
------------

[](#introduction)

This repo is based on a failed Laravel framework PR from us: [laravel/framework#45604](https://github.com/laravel/framework/pull/45604)

Because we still find it to be very useful we extracted it to a package.

The idea is very simple and can be formulated in one sentence:

### Logging facility should never crash your app

[](#logging-facility-should-never-crash-your-app)

Or to re-phrase:

### Under no circumstances, none at all, logging facility should crash your app

[](#under-no-circumstances-none-at-all-logging-facility-should-crash-your-app)

People rely on logs when things go bad so the last thing you want to happen is for things to go bad because of logging.

As an example, try crashing JavaScript's console.log (good luck!):

```
console.log('plain message')
// plain message
console.log('plain message', 123, [])
// plain message 123 []
```

You can send anything and it just works. Because when things go bad, you don't want to worry about logs making things even worse.

Now coming back to Laravel, it's trivial to break the whole application when using the Log facade:

```
Log::emergency('Something bad happened!', false);
Illuminate\Log\LogManager::emergency(): Argument #2 ($context) must be of type array, bool given, called in vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 338 in vendor/psy/psysh/src/Exception/TypeErrorException.php on line 53.
```

If this looks too artificial, here is a real-world example:

```
try {
    $details = $api->request(); // $api is some kind of a third-party SDK
} catch (ClientException $e) {
    // $e->getResponse() might have a nice JSON error message but might have a CDN's HTML error or something else
    Log::emergency("Oh no, we got a failed API request!", json_decode($e->getResponse()->getContent()));
}
```

And yes - developers CAN be careful and always pass correct arguments, a string and an array, but do we want to be careful with loggers? Does that make sense for you?

If you refer to the PSR documentation:

```
1.3 Context
...The array can contain anything. Implementors MUST ensure they treat context data with as much lenience as possible. A given value in the context MUST NOT throw an exception nor raise any php error, warning or notice.

```

It actually mentions how we should never throw any errors or exceptions and should be as lenient as possible.

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

[](#installation)

```
$ composer require tixelrocks/laravel-safe-logger
```

That's it! Now we can do "funky" stuff like:

```
Log::emergency("Hello", $results, 'Another message');
```

Of course, we don't have to. But it's just nice to be able not to worry about Log crashing your app ever.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance50

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 54.5% 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 ~302 days

Total

4

Last Release

354d ago

PHP version history (2 changes)0.1PHP &gt;=7.1

0.2PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/a44ee42fe69a7926153637c0249b0faf83a1a67edd1231f449a74dcf5721c345?d=identicon)[dusterio](/maintainers/dusterio)

---

Top Contributors

[![dusterio](https://avatars.githubusercontent.com/u/11039918?v=4)](https://github.com/dusterio "dusterio (6 commits)")[![Flipjms](https://avatars.githubusercontent.com/u/8956652?v=4)](https://github.com/Flipjms "Flipjms (3 commits)")[![camgrsl](https://avatars.githubusercontent.com/u/4834305?v=4)](https://github.com/camgrsl "camgrsl (1 commits)")[![jryd](https://avatars.githubusercontent.com/u/13251203?v=4)](https://github.com/jryd "jryd (1 commits)")

---

Tags

laravellogginglogger

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tixelrocks-laravel-safe-logger/health.svg)

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

###  Alternatives

[guanguans/laravel-exception-notify

Monitor exception and report to the notification channels(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).

14844.4k1](/packages/guanguans-laravel-exception-notify)[markrogoyski/simplelog-php

Powerful PSR-3 logging. So easy, it's simple.

2819.1k4](/packages/markrogoyski-simplelog-php)

PHPackages © 2026

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