PHPackages                             xraffsarr/php-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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. xraffsarr/php-logger

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

xraffsarr/php-logger
====================

A simple PHP logger

2.0.0(4y ago)222MITPHPPHP &gt;=8.0

Since Dec 31Pushed 4y ago1 watchersCompare

[ Source](https://github.com/0xRaffSarr/php-logger)[ Packagist](https://packagist.org/packages/xraffsarr/php-logger)[ RSS](/packages/xraffsarr-php-logger/feed)WikiDiscussions main Synced 6d ago

READMEChangelog (3)Dependencies (1)Versions (5)Used By (0)

PhpLogger
=========

[](#phplogger)

[![GitHub release](https://camo.githubusercontent.com/6f6ea80736dcffc4609934307ab341076b602d74c8cf8a42de0d7b53177d6d84/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f307852616666536172722f7068702d6c6f67676572)](https://camo.githubusercontent.com/6f6ea80736dcffc4609934307ab341076b602d74c8cf8a42de0d7b53177d6d84/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f307852616666536172722f7068702d6c6f67676572)[![GitHub license](https://camo.githubusercontent.com/001af690c76aab8b7d5ae08f9af51b4fbf5dbad7b012202d3839ef863279c0fd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f307852616666536172722f7068702d6c6f67676572)](https://github.com/0xRaffSarr/php-logger/blob/main/LICENSE)[![GitHub top language](https://camo.githubusercontent.com/29b0ea5c78e6bcb423148fe81dcfc08c18b5cc798b0fcafe3b988e6418074305/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f746f702f307852616666536172722f7068702d6c6f67676572)](https://camo.githubusercontent.com/29b0ea5c78e6bcb423148fe81dcfc08c18b5cc798b0fcafe3b988e6418074305/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f746f702f307852616666536172722f7068702d6c6f67676572)[![Packagist PHP Version Support](https://camo.githubusercontent.com/b098f38423693383a3fd936925c6b756a5ee48b75d57e44dcb3e7d0916311d0a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7872616666736172722f7068702d6c6f67676572)](https://camo.githubusercontent.com/b098f38423693383a3fd936925c6b756a5ee48b75d57e44dcb3e7d0916311d0a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7872616666736172722f7068702d6c6f67676572)[![GitHub issues](https://camo.githubusercontent.com/df702fa56877d934c1ea1ee59d506a0ee8e41987f233e2df699ebd53d5d0b6e8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f307852616666536172722f7068702d6c6f67676572)](https://github.com/0xRaffSarr/php-logger/issues)[![Packagist Downloads](https://camo.githubusercontent.com/53ee28d8fc7ef9bc46f09d7c15a3100e25bd5b75d6512d4e90774e1ba3a5d5be/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7872616666736172722f7068702d6c6f67676572)](https://camo.githubusercontent.com/53ee28d8fc7ef9bc46f09d7c15a3100e25bd5b75d6512d4e90774e1ba3a5d5be/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7872616666736172722f7068702d6c6f67676572)[![GitHub code size in bytes](https://camo.githubusercontent.com/e2e498eb49f6b7bdfec189b65400fd704aa6a4756557523aef732d790b95476c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f307852616666536172722f7068702d6c6f67676572)](https://camo.githubusercontent.com/e2e498eb49f6b7bdfec189b65400fd704aa6a4756557523aef732d790b95476c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f307852616666536172722f7068702d6c6f67676572)

A php logger based on [`psr/log`](https://github.com/php-fig/log) interface.

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

[](#installation)

The package can be installed via Composer:

```
composer require xraffsarr/php-logger
```

Configuration
-------------

[](#configuration)

FOr usage via Facade pattern within the project, you only need to indicate the path to save the log

```
use PhpLogger\Facade\Log;

Log::setLogPath('[pathToSave]');
```

Replacing `pathToSave` with the desired path.

You can configure the type of log and the method to. If you want the logs to be saved in JSON format, you can set the JSON writer with.

```
use PhpLogger\Facade\Log;
use PhpLogger\LoggerType;

Log::setLogType(LoggerType::JSON_WRITER);
```

In that case the resulting file `log.json`, will contain an array of JSON objects in the format:

```
{
    "date_time": "19\/02\/2022 14:47:50",
    "level": "emergency",
    "message": "Test debug logger Facade",
    "context": {
        "user": {
            "name": "Mario",
            "surname": "Rossi"
        },
        "data": [
            "a",
            "b",
            {
                "t": "a",
                "a": "b"
            }
        ]
    }
}
```

Usage
-----

[](#usage)

The Logger can be used via Facade or instantiating a logger with its own configurations.

### Via Facade

[](#via-facade)

You can use the logger via Facade, simply by invoking the desired methods related to the type of log.

```
use PhpLogger\Facade\Log;

Log::debug('Debug log', [
    'data' => [
        ...
    ]
]);
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

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

Total

3

Last Release

1548d ago

Major Versions

1.0.1 → 2.0.02022-02-19

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/38242478?v=4)[Raffaele Sarracino](/maintainers/0xRaffSarr)[@0xRaffSarr](https://github.com/0xRaffSarr)

---

Top Contributors

[![0xRaffSarr](https://avatars.githubusercontent.com/u/38242478?v=4)](https://github.com/0xRaffSarr "0xRaffSarr (59 commits)")

### Embed Badge

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

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

###  Alternatives

[sentry/sentry

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

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

Monitors errors and exceptions and reports them to Rollbar

33723.7M82](/packages/rollbar-rollbar)[illuminate/log

The Illuminate Log package.

6224.3M518](/packages/illuminate-log)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2222.9M248](/packages/open-telemetry-sdk)[open-telemetry/api

API for OpenTelemetry PHP.

1833.0M214](/packages/open-telemetry-api)[pagemachine/typo3-formlog

Form log for TYPO3

23225.3k6](/packages/pagemachine-typo3-formlog)

PHPackages © 2026

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