PHPackages                             phossa/phossa-logger - 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. [Framework](/categories/framework)
4. /
5. phossa/phossa-logger

ActiveLibrary[Framework](/categories/framework)

phossa/phossa-logger
====================

The PSR-3 compliant PHP logging library.

1.0.7(10y ago)1191MITPHPPHP &gt;=5.4.0

Since Nov 2Pushed 6y ago1 watchersCompare

[ Source](https://github.com/phossa/phossa-logger)[ Packagist](https://packagist.org/packages/phossa/phossa-logger)[ Docs](https://github.com/phossa/phossa-logger)[ RSS](/packages/phossa-phossa-logger/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (7)Dependencies (2)Versions (9)Used By (0)

phossa-logger \[ABANDONED\]
===========================

[](#phossa-logger-abandoned)

[![Build Status](https://camo.githubusercontent.com/c348d79ec6a3729aa8525cacd32ca72f09154a38bb1c1738aca0487ccbd4a805/68747470733a2f2f7472617669732d63692e6f72672f70686f7373612f70686f7373612d6c6f676765722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/phossa/phossa-logger.svg?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/e9e4ffa495a701ee998b3907a67033598087d280c25e92afbfc1d42f984f0f9e/68747470733a2f2f706f7365722e707567782e6f72672f70686f7373612f70686f7373612d6c6f676765722f762f737461626c65)](https://packagist.org/packages/phossa/phossa-logger)[![License](https://camo.githubusercontent.com/df9b90686353233ae8cdb1d487bc40507550e7318dabc528187256a67358d4c0/68747470733a2f2f706f7365722e707567782e6f72672f70686f7373612f70686f7373612d6c6f676765722f6c6963656e7365)](https://packagist.org/packages/phossa/phossa-logger)

**See new lib at [phoole/logger](https://github.com/phoole/logger)**

Introduction
------------

[](#introduction)

Phossa-logger is a PSR-3 compliant logging library. It is a rewrite of Monolog with lots of changes.

More information about [PSR-3](http://www.php-fig.org/psr/psr-3/)

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

[](#installation)

Install via the `composer` utility.

```
composer require "phossa/phossa-logger=1.*"

```

or add the following lines to your `composer.json`

```
{
    "require": {
       "phossa/phossa-logger": "^1.0.5"
    }
}
```

Usage
-----

[](#usage)

- Simple usage

    ```
    // logger with id 'mylogger'
    $logger = new \Phossa\Logger\Logger('mylogger');

    // a notice
    $logger->notice('a notice from code');

    // a warning
    $logger->warning('a warning from code');
    ```

Features
--------

[](#features)

- Decorator: used to modify the `$logEntry` in some way.

    - Implements the `__invoke()` method, makes decorator a callable

        ```
        class InterpolateDecorator extends DecoratorAbstract
        {
            public function __invoke(LogEntryInterface $log)
            {
                // ...
            }
        }
        ```
    - User-defined functions can also be used as decorator

        ```
        $logger->setDecorators([
            new Decorator/InterpolateDecorator(),
            function ($logEntry) {
                // ...
            }
        ]);
        ```
    - Decorator implements `DecoratorInterface` can be disabled at runtime

        ```
        $inter = new Decorator/InterpolateDecorator();
        $logger->addDecorator($inter);
        // ...

        // disble the InterpolateDecorator at runtime
        $inter->stopDecorator();
        ```
- Handler: distribute log entry to different devices. Multiple handlers can be set at the same time.

    ```
    // create a logger with channel 'MyLogger'
    $logger  = new Logger('MyLogger');

    // syslog handler with ident set to 'MyLogger'
    $syslog  = new Handler\SyslogerHandler($logger->getChannel());

    // console handler with output to stderr
    $console = new Handler\TerminalHandler();

    // add handlers
    $logger->addHandler($syslog);
    $logger->addHandler($console);

    // ...
     // at some point, stop console logging
    $console->stopHandler();
    ```
- Formatter: turn log entry object into string. A formatter is bound to a specific handler.

    ```
    // console handler with output to stderr
    $console = new Handler\TerminalHandler();

    // set AnsiFormatter
    $console->setFormatter(new Formatter\AnsiFormatter());
    ```
- Handler/Decorator/Formatter all enforce '\_\_invoke()' in the their interface, which makes them callable.
- User may use all sorts of callable as handler, decorator or formatter.

    ```
    // handler
    $syslog = new SyslogHandler();

    // set a anonymous function as a formatter
    $syslog->setFormatter(
        function ($log) {
            // ...
            return $string;
        }
    );

    // adding different handlers
    $logger->setHandlers([
        $syslog,
        function ($log) {
            // convert $log to string and send to a log device
            // ...
        }
    ]);
    ```
- `LogEntryInterface` for log entry (or call it message). It is now possible to extend `LogEntry` and use a factory closure to create log entry.

    ```
    $logger = new Logger('MyLogger', [], [],
        function ($level, $message, $context) {
            return new MyLogEntry($level, $message, $context);
        }
    );
    ```
- Support PHP 5.4+, PHP 7.0+, HHVM
- PHP7 ready for return type declarations and argument type declarations.
- PSR-1, PSR-2, PSR-3, PSR-4 compliant.

Dependencies
------------

[](#dependencies)

- PHP &gt;= 5.4.0
- phossa/phossa-shared &gt;= 1.0.3
- psr/log

License
-------

[](#license)

[MIT License](http://mit-license.org/)

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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

Total

8

Last Release

3679d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f8140b30658c77b72e1596e6cbc4cf1cd9b308f636a8adf125d09af74ee52124?d=identicon)[phossa](/maintainers/phossa)

---

Top Contributors

[![phossa](https://avatars.githubusercontent.com/u/8499165?v=4)](https://github.com/phossa "phossa (25 commits)")

---

Tags

psrpsr-3frameworkloggingphossa

### Embed Badge

![Health badge](/badges/phossa-phossa-logger/health.svg)

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

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[yiisoft/log

Yii Logging Library

42917.2k26](/packages/yiisoft-log)[chubbyphp/chubbyphp-framework

A minimal, highly performant middleware PSR-15 microframework built with as little complexity as possible, aimed primarily at those developers who want to understand all the vendors they use.

13544.4k4](/packages/chubbyphp-chubbyphp-framework)[phalcon/phalcon

Phalcon Framework

2421.5k1](/packages/phalcon-phalcon)[antidot-fw/framework

Anti.Framework library

183.2k5](/packages/antidot-fw-framework)

PHPackages © 2026

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