explaingit

php-fig/log

10,440PHPAudience · developerComplexity · 1/5Setup · easy

TLDR

A minimal PHP package that defines a standard logging interface (PSR-3) so any PHP project can swap one logging library for another without changing application code.

Mindmap

mindmap
  root((repo))
    What it does
      Logging standard
      PHP interface only
      Swappable loggers
    Standard
      PSR-3 interface
      PHP-FIG group
      Composer install
    Log Levels
      Error and warning
      Info and debug
    Audience
      PHP developers
      Library authors
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Add a standard LoggerInterface type hint to your PHP classes so any PSR-3-compatible logger can be injected at runtime.

USE CASE 2

Write a reusable PHP library that supports logging without forcing users to depend on a specific logging tool.

Tech stack

PHPComposer

Getting it running

Difficulty · easy Time to first run · 5min

In plain English

This repository is not an actual logging tool. It defines a standard interface that describes what a logger should look like in PHP applications. The idea is that different PHP projects can agree on a shared contract for logging so that any library or application can swap out one logging solution for another without changing the surrounding code. The standard is called PSR-3, and it was produced by the PHP Framework Interoperability Group, a group of PHP project maintainers who collaborate on shared technical standards. By depending on this interface rather than a specific logger, your code stays compatible with many different logging libraries that implement the same contract. Installation is handled via Composer, which is the standard PHP package manager. Once installed, you can type-hint against the LoggerInterface in your own classes, and then inject whichever concrete logger you prefer at runtime. The README is brief and the package is intentionally minimal because its only job is to define the interface, not to provide the logging logic itself.

Copy-paste prompts

Prompt 1
Show me how to use the PSR-3 LoggerInterface from php-fig/log in my PHP class so I can inject Monolog or any other PSR-3 logger at runtime.
Prompt 2
Help me write a PHP service class that accepts a LoggerInterface and logs important events using the php-fig/log PSR-3 standard.
Prompt 3
What log levels does PSR-3 define, and how do I use the php-fig/log interface to log errors, warnings, and debug messages in a PHP application?
Open on GitHub → Explain another repo

← php-fig on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.