Monolog

The PSR-3 logging library that sends PHP logs to files, sockets, databases, and dozens of web services

Library
Composer
v3.10.0
21,398stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
77/100Good
Development Activity68
Maintenance64
Community76
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
84/100Excellent
Architecture90
Code Quality88
Innovation80
Learning Curve78

Monolog is the de facto standard logging library for PHP, implementing the PSR-3 logger interface so that applications and libraries can log against a common contract and swap implementations freely. It ships with over 70 handlers covering local files, syslog, Slack, Sentry, Elasticsearch, AWS services, email, Redis, and many other destinations, plus a processor system for enriching log records with context like memory usage, request IDs, or stack traces before they’re written.

With more than 21,000 GitHub stars, 568 contributors, and roughly 16.5 million monthly Composer installs, Monolog ships out of the box with Symfony, Laravel, and Lumen, and is usable in virtually every other PHP framework via community bridges. Its handler/processor/formatter pipeline architecture has become the reference design that other PHP logging libraries are compared against.

What You Get

  • A PSR-3-compliant Logger class usable as a drop-in dependency in any framework or library
  • Over 70 built-in handlers for destinations including files, syslog, Slack, Sentry, Elasticsearch, AWS, Redis, and email
  • A processor pipeline for enriching log records with extra context (memory usage, web request data, introspection, tags) before they’re written
  • Formatters (line, JSON, HTML, GELF, and more) to control the exact shape of emitted log output
  • Built-in framework support in Symfony, Laravel, and Lumen, with community bridges for most other PHP frameworks

Common Use Cases

  • Centralizing application logs from a Symfony or Laravel app into a single PSR-3 logger dependency
  • Routing error-level logs to Slack or Sentry in production while writing debug-level logs to local files in development
  • Shipping structured JSON logs to Elasticsearch or a log-aggregation service for searchable observability
  • Building a library that logs internally without hard-coding a specific logging backend, by type-hinting against the PSR-3 interface

Under The Hood

Architecture — Monolog’s src/Monolog directory centers on a Logger class (implementing PSR-3) that holds an ordered stack of Handler instances; each log call walks the stack, letting handlers decide via a minimum log level whether to process the record. Processor classes run before handlers to mutate the LogRecord (adding memory usage, web/CLI context, or custom tags), and Formatter classes control how each handler serializes the final record — a clean separation that lets one log call fan out to a file, Slack, and Sentry simultaneously with independent formatting for each.

Tech Stack — Requires only PHP 8.1+ and psr/log at runtime; the extensive require-dev list (aws/aws-sdk-php, elasticsearch/elasticsearch, guzzlehttp/guzzle, mongodb/mongodb, predis/predis, rollbar/rollbar, symfony/mailer, and more) reflects optional integrations exercised only in tests for handlers targeting those services — none of them are hard runtime dependencies of the core library.

Code Quality — 94 test files back the 71 handlers and processor/formatter classes, and the project runs PHPStan (with strict rules and deprecation-rule plugins, plus per-PHP-version baseline files) as a CI gate. The UPGRADE.md and versioned CHANGELOG.md document breaking changes carefully across major versions, and 568 contributors over 2,884 commits reflect long-running community stewardship since 2011.

API Design — The core Logger/pushHandler() API is small and PSR-3-idiomatic ($log->warning('Foo')), so consumers rarely need more than a few lines to get started; complexity is opt-in and lives in configuring specific handlers (e.g. StreamHandler, SlackWebhookHandler) rather than in the logger itself, which keeps the common path simple while still exposing the full pipeline for advanced setups.

Used by 6 apps in this directory

PHP
78%
Other

Craft CMS

CMS

3,601

A developer-first PHP CMS with clean-slate content modeling, auto-generated GraphQL API, and a four-tier edition system that scales from solo projects to enterprise deployments.

View details
96
Repo Health
83
Technical
63
Dependency
Built with
PHP78%
JavaScript14%
Updated today
Shell
48%
MIT

Dokku

Devops · Hosting Control Panel

32,105

The smallest PaaS implementation you've ever seen — deploy apps via git push using Docker and Heroku buildpacks on your own server.

View details
93
Repo Health
85
Technical
75
Dependency
Built with
Shell48%
Go48%
Updated today
PHP
66%
AGPL 3.0

EspoCRM

Marketing · Ecommerce · CRM

3,259

Open-source CRM platform with metadata-driven customization, field-level permissions, and a full REST API — deploy on your own infrastructure.

View details
97
Repo Health
72
Technical
64
Dependency
Built with
PHP66%
JavaScript24%
Updated yesterday
PHP
79%
GPL 3.0

matomo

Analytics

21,786

Open-source, privacy-first web and app analytics that puts you in complete control of your data.

View details
95
Repo Health
82
Technical
62
Dependency
Built with
PHP79%
Updated today
PHP
80%
GPL 2.0

Open Web Analytics

Analytics

2,684

Self-host your own Google Analytics alternative with heatmaps, session recordings, and full data ownership — no cloud required.

View details
88
Repo Health
51
Technical
69
Dependency
Built with
PHP80%
JavaScript19%
Updated today
PHP
84%
MIT

wallabag

Bookmarks Archiving

12,917

Self-hosted read-it-later app that saves clean, ad-free articles from any webpage for distraction-free reading across all your devices.

View details
92
Repo Health
81
Technical
59
Dependency
Built with
PHP84%
Twig13%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search