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(11mo ago)327MITPHPPHP ^8.2CI passing

Since May 11Pushed 3mo ago1 watchersCompare

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

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

34

—

LowBetter than 75% of packages

Maintenance68

Regular maintenance activity

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

334d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15609300?v=4)[Pankaj Aagjal](/maintainers/aagjalpankaj)[@aagjalpankaj](https://github.com/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/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.5k55.4M8.5k](/packages/larastan-larastan)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M307](/packages/laravel-horizon)[laravel/sail

Docker files for running a basic Laravel application.

1.9k205.7M1.3k](/packages/laravel-sail)[laravel/octane

Supercharge your Laravel application's performance.

4.0k26.6M223](/packages/laravel-octane)

PHPackages © 2026

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