PHPackages                             php-unified/log - 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. php-unified/log

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

php-unified/log
===============

A PHP standard for logging.

2.1.1(5y ago)3462MITPHPPHP ^8.0CI failing

Since Jan 10Pushed 5y ago1 watchersCompare

[ Source](https://github.com/php-unified/log)[ Packagist](https://packagist.org/packages/php-unified/log)[ RSS](/packages/php-unified-log/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (8)Dependencies (2)Versions (9)Used By (2)

[![Build Status](https://camo.githubusercontent.com/c7b7ae4827c8f76d59f6314993e80a26115711d77518bfa232a0db251ff234b6/68747470733a2f2f7472617669732d63692e636f6d2f7068702d756e69666965642f6c6f672e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/php-unified/log)

PHP Unified Log
===============

[](#php-unified-log)

This package provides a standard for logging in PHP. The package aims to create a multi-use standard.

Please note that this package only contains interfaces for the implementation and a non-logging implementation.

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

[](#installation)

```
composer require php-unified/log
```

Usage
-----

[](#usage)

### Provided interfaces

[](#provided-interfaces)

#### PhpUnified\\Log\\Common\\LoggerInterface

[](#phpunifiedlogcommonloggerinterface)

This interface provides a standard for implementing loggers into applications. It exposes three functions.

##### log

[](#log)

This function is meant for logging a message with a severity indication. The severity indication can be picked from the constants defined in the interface.

##### Constants

[](#constants)

The constants in this class can be used to determine the severity of the log.

###### EMERGENCY

[](#emergency)

The system has become unuseable. Multiple components of the system have stopped working.

###### FATAL

[](#fatal)

A fatal(ity) is a complete failure of the application. Immediate action should be taken. Normal operation most likely can not be continued without action. The user experience is completely disrupted.

###### ERROR

[](#error)

An error is a significant failure in the application. These types of errors should be prioritized. Normal operation can continue, but might disrupt again. The user experience did get affected.

###### WARNING

[](#warning)

A warning is a potential failure in the application. Normal operation can continue, but the underlying issue can result in additional issues with a greater severity. The user experience most likely didn't get affected.

###### NOTICE

[](#notice)

A notice is a minor disruption in the application. Normal operation is possible. However the warning can have adverse affects if left untreated.

###### INFO

[](#info)

These logs are meant to supply information about the system. E.g. which processes have been run.

###### DEBUG

[](#debug)

Logs information meant for developers. E.g. performance statistics.

#### PhpUnified\\Log\\Common\\OptionalLoggingInterface

[](#phpunifiedlogcommonoptionallogginginterface)

This interface provides a standard for an implementation which can optionally log information. This can be useful when less information should be logged in a production environment opposed to development environments.

#### PhpUnified\\Log\\Common\\TransitLoggerInterface

[](#phpunifiedlogcommontransitloggerinterface)

This interface provides a standard for multi-logger. The implementation of this interface should function a pass-through to several other implementations of the `LoggerInterface`. This could be useful if logs should be stored in multiple places or in different formats.

For this interface, an implementation is provided. See: `PhpUnified\Log\TransitLogger`.

### Require a logger

[](#require-a-logger)

To create an implementation which requires a logger, implement the following snippet:

```
namespace YourOrganization\YourPackage;

use PhpUnified\Log\Common\LoggerInterface;

class YourClass
{
    /**
     * @var LoggerInterface
     */
    private $logger;

    /**
     * Constructor
     *
     * @param LoggerInterface $logger
     */
    public function __construct(LoggerInterface $logger)
    {
        $this->logger = $logger;
    }

    /**
     * The description of my function.
     *
     * @return void
     */
    public function myFunction(): void
    {
        //some code
        $this->logger->log(LoggerInterface::WARNING, 'Something non-severe happened.');
    }
}
```

### Optional logger

[](#optional-logger)

To create an implementation which can optionally log information, implement the following snippet:

```
namespace YourOrganization\YourPackage;

use PhpUnified\Log\Common\OptionalLoggingInterface;
use PhpUnified\Log\Common\LoggerInterface;

class YourClass implements OptionalLoggingInterface
{
    /**
     * @var LoggerInterface
     */
    private $logger;

    /**
     * Optionally set a logger after instantiation.
     *
     * @param LoggerInterface $logger
     *
     * @return void
     */
    public function setLogger(LoggerInterface $logger): void
    {
        $this->logger = $logger;
    }

    /**
     * The description of my function.
     *
     * @return void
     */
    public function myFunction(): void
    {
        //some code
        if ($this->logger !== null) {
            $this->logger->log(LoggerInterface::WARNING, 'Something non-severe happened.');
        }
    }
}
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

MIT License
-----------

[](#mit-license)

Copyright (c) GrizzIT

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity71

Established project with proven stability

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

Recently: every ~199 days

Total

8

Last Release

1830d ago

Major Versions

1.0.4 → 2.0.02020-11-10

PHP version history (3 changes)1.0.0PHP ^7.2

2.0.0PHP ^7.3

2.1.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8682881?v=4)[GrizzIT](/maintainers/GrizzIT)[@grizzit](https://github.com/grizzit)

---

Top Contributors

[![mfrankruijter](https://avatars.githubusercontent.com/u/8653925?v=4)](https://github.com/mfrankruijter "mfrankruijter (11 commits)")

---

Tags

guidelinelogphpstandardlog

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/php-unified-log/health.svg)

```
[![Health](https://phpackages.com/badges/php-unified-log/health.svg)](https://phpackages.com/packages/php-unified-log)
```

###  Alternatives

[monolog/monolog

Sends your logs to files, sockets, inboxes, databases and various web services

21.4k964.9M7.0k](/packages/monolog-monolog)[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[symfony/monolog-bundle

Symfony MonologBundle

2.9k249.1M1.6k](/packages/symfony-monolog-bundle)[spatie/laravel-activitylog

A very simple activity logger to monitor the users of your website or application

5.8k45.4M309](/packages/spatie-laravel-activitylog)[sentry/sentry

PHP SDK for Sentry (http://sentry.io)

1.9k227.1M273](/packages/sentry-sentry)[sentry/sentry-laravel

Laravel SDK for Sentry (https://sentry.io)

1.3k114.3M154](/packages/sentry-sentry-laravel)

PHPackages © 2026

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