PHPackages                             akhilduggirala/laravel-log-enhancer - 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. akhilduggirala/laravel-log-enhancer

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

akhilduggirala/laravel-log-enhancer
===================================

Enhanced logging helpers for Laravel (smart message/context normalization).

v0.1.2(7mo ago)23MITPHPPHP &gt;=8.1

Since Nov 15Pushed 7mo agoCompare

[ Source](https://github.com/AKHIL-882/laravel-log-enhancer)[ Packagist](https://packagist.org/packages/akhilduggirala/laravel-log-enhancer)[ RSS](/packages/akhilduggirala-laravel-log-enhancer/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (4)Versions (4)Used By (0)

📦 Laravel Log Enhancer
======================

[](#-laravel-log-enhancer)

Effortless deep normalization for Laravel logging

Laravel Log Enhancer provides a convenient helper function (smart\_info()) that automatically normalizes complex data structures before passing them to Laravel's logging system.

Instead of dumping raw objects, collections, models, or other structures into log files, this package converts them into clean, serializable arrays — deeply and recursively.

Perfect for debugging, API responses, model data, or anything that ends up messy when logged normally.

🚀 Features
==========

[](#-features)

🔁 Deep recursive normalization Converts nested structures into log-friendly arrays.

📦 Supports:
===========

[](#-supports)

- Collection
- Arrayable
- Jsonable
- JsonSerializable
- Traversable
- WeakMap
- Generic objects

🎯 Simple helper:
================

[](#-simple-helper)

\-- smart\_info($message, $context);

🎉 Fully tested (PHPUnit + Orchestra Testbench)
==============================================

[](#-fully-tested-phpunit--orchestra-testbench)

🔧 Zero configuration needed — works instantly via Laravel auto-discovery

📥 Installation
==============

[](#-installation)

`composer require akhilduggirala/laravel-log-enhancer`

Laravel’s package auto-discovery will register everything automatically. No manual setup required.

🧠 What Problem Does This Solve?
===============================

[](#-what-problem-does-this-solve)

Logging in Laravel works great for simple messages — but breaks when you try to log objects, collections, or deep nested arrays:

`Log::info('data', ['payload' => collect([1,2,3])]);`

This results in:

`payload: Collection { ... }`

Hard to read. Not JSON-friendly. Not searchable.

This package fixes that.

✨ Usage
=======

[](#-usage)

Use the global helper:

`smart_info($message, $context = []);`

### Example 1 — Logging Collections

[](#example-1--logging-collections)

```
smart_info('User data', [
    'roles' => collect(['admin', 'editor']),
]);

Result logged:

{
    "message": "User data",
    "roles": ["admin", "editor"]
}

```

### Example 2 — Logging Models

[](#example-2--logging-models)

```
smart_info('Created user', $user);

```

Model gets converted automatically using toArray().

### Example 3 — Nested Arrays + Objects

[](#example-3--nested-arrays--objects)

```

smart_info('Checkout processed', [
    'cart' => [
    'items' => collect([1,2,3]),
    'user' => $user,
    ]
]);

Becomes:

{
    "cart": {
    "items": [1,2,3],
    "user": { ...model attributes... }
    }
}

```

🔍 How It Works
==============

[](#-how-it-works)

The Normalizer class recursively normalizes any data type using:

- Arrayable::toArray()
- Jsonable::toJson()
- JsonSerializable::jsonSerialize()
- Traversable::iterator\_to\_array()
- Reflection on generic objects (get\_object\_vars())
- Everything becomes clean arrays/scalars before logging.

🧪 Running Tests
===============

[](#-running-tests)

Clone the repo and install dependencies:

`composer install`

Run the test suite:

`./vendor/bin/phpunit`

Tests include:

Normalization of message

Normalization of nested context

Logging behavior using Laravel’s Log façade with Mockery

🤝 Contributing
==============

[](#-contributing)

Pull requests are welcome!

Fork the repository

Create a new branch

Add your changes + tests

Submit a pull request

Please follow PSR-12 coding standards.

📄 License
=========

[](#-license)

This package is open-source and licensed under the MIT License. See the LICENSE.

⭐️ Support the Project

If this package helps you write cleaner logs:

Star the repo on GitHub ❤️

Share it with your Laravel dev friends

### Developed by Akhil Duggirala

[](#developed-by-akhil-duggirala)

Inputs:: Mail-

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance63

Regular maintenance activity

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 66.7% 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 ~1 days

Total

3

Last Release

227d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/51040667?v=4)[Duggirala Akhil](/maintainers/AKHIL-882)[@AKHIL-882](https://github.com/AKHIL-882)

---

Top Contributors

[![Akhil-Duggirala](https://avatars.githubusercontent.com/u/114069597?v=4)](https://github.com/Akhil-Duggirala "Akhil-Duggirala (4 commits)")[![AKHIL-882](https://avatars.githubusercontent.com/u/51040667?v=4)](https://github.com/AKHIL-882 "AKHIL-882 (2 commits)")

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/akhilduggirala-laravel-log-enhancer/health.svg)

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

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

87512.0M164](/packages/spatie-laravel-health)[illuminate/log

The Illuminate Log package.

6225.3M622](/packages/illuminate-log)[spatie/laravel-flare

Send Laravel errors to Flare

111.4M7](/packages/spatie-laravel-flare)

PHPackages © 2026

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