PHPackages                             aagjalpankaj/logstan - 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. aagjalpankaj/logstan

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

aagjalpankaj/logstan
====================

PHPStan extension for Laravel applications to enforce consistent logging practices.

v0.2.0(9mo ago)327MITPHPPHP ^8.2CI passing

Since May 11Pushed 1mo ago1 watchersCompare

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

READMEChangelog (3)Dependencies (7)Versions (5)Used By (0)

Logstan
=======

[](#logstan)

[ ![ci](https://github.com/aagjalpankaj/logstan/actions/workflows/ci.yml/badge.svg)](https://github.com/aagjalpankaj/logstan/actions/workflows/ci.yml)[ ![Downloads](https://camo.githubusercontent.com/5be13967d43e372f36c9e4a67eed606fbc279b0b1d8bf70f2b7c85029e1ba689/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6161676a616c70616e6b616a2f6c6f677374616e)](https://packagist.org/packages/aagjalpankaj/logstan)

About
-----

[](#about)

LogStan is a PHPStan extension that helps you to enforce structured and consistent logging in Laravel.

### Example Output

[](#example-output)

```
./vendor/bin/logstan analyse

 ------ --------------------------------------------------------------------------------------------
  Line   Actions/CreateOrderAction.php
 ------ --------------------------------------------------------------------------------------------
  21     Log message "order created" should start with an uppercase letter.
  67     Log context key "orderId" should be in snake_case format.
  94     Log context has too many keys (11). Maximum allowed are 10.
 ------ --------------------------------------------------------------------------------------------

 ------ --------------------------------------------------------------------------------------------
  Line   Services/ShopifyService.php
 ------ --------------------------------------------------------------------------------------------
  57     Log context value of key "order" must be scalar, null or array of scalar.
         "App\Models\Order" provided.
 ------ --------------------------------------------------------------------------------------------

 [ERROR] Found 4 errors

```

---

 [Installation](#installation) | [Usage](#usage) | [Logging standards enforced](#logging-standards-enforced)

---

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

[](#installation)

```
composer require --dev aagjalpankaj/logstan
```

Usage
-----

[](#usage)

### Analyzing Logs

[](#analyzing-logs)

```
./vendor/bin/logstan analyse
```

This command will scan your application and report any inconsistencies or potential problems with the logs in your application.

### Getting Insights

[](#getting-insights)

```
./vendor/bin/logstan insights
```

This command provides insights about logs in your application.

### Configuration (Optional)

[](#configuration-optional)

```
cp ./vendor/aagjalpankaj/logstan/logstan.neon.dist logstan.neon
```

You can override default presets in `logstan.neon`

### Help

[](#help)

For more information about available commands and options:

```
./vendor/bin/logstan --help
```

Logging standards enforced
--------------------------

[](#logging-standards-enforced)

Logstan ensures your Laravel application follows best practices for logging by enforcing the following standards:

### Log Messages

[](#log-messages)

StandardDescription✅ **Non-empty requirement**All log messages must contain meaningful content✅ **Character limit**Messages are validated against maximum length constraints✅ **Proper capitalization**Messages must begin with uppercase letters for consistency### Log Context

[](#log-context)

StandardDescription✅ **Array structure**Context data must be provided as a properly formatted array✅ **Key limit**Maximum of 10 context keys to maintain readability✅ **Naming convention**Keys must use snake\_case format and be non-empty strings✅ **Data types**Values restricted to scalar types or null (arrays/objects prohibited)✅ **Value length**Context values limited to 100 characters maximum✅ **Security compliance**Automatic detection and prevention of sensitive information in keysContributing
------------

[](#contributing)

Found a bug or have a feature request? We'd love to hear from you!

- 🐛 **Report Issues**: [Create an issue](https://github.com/aagjalpankaj/logstan/issues)
- 💡 **Feature Requests**: [Create an issue](https://github.com/aagjalpankaj/logstan/issues)
- 🤝 **Pull Requests**: [Create PR](https://github.com/aagjalpankaj/logstan/pulls)

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance76

Regular maintenance activity

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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 ~42 days

Total

3

Last Release

278d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0349c7c955142c33903744bb5a23a3e5aa2ba0238dc7b972c47b1fe82f2077de?d=identicon)[aagjalpankaj](/maintainers/aagjalpankaj)

---

Top Contributors

[![aagjalpankaj](https://avatars.githubusercontent.com/u/15609300?v=4)](https://github.com/aagjalpankaj "aagjalpankaj (39 commits)")

---

Tags

consistencylaravellogsphpstanPHPStanlaraveldevlogsconsistency

###  Code Quality

TestsPest

Static AnalysisRector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/aagjalpankaj-logstan/health.svg)

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

###  Alternatives

[laravel/pail

Easily delve into your Laravel application's log files directly from the command line.

91245.3M585](/packages/laravel-pail)[jackiedo/log-reader

An easy log reader and management tool for Laravel

151376.5k4](/packages/jackiedo-log-reader)[kssadi/log-tracker

A powerful, intuitive, and efficient log viewer for Laravel applications.

264.8k](/packages/kssadi-log-tracker)

PHPackages © 2026

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