PHPackages                             juanchosl/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. juanchosl/logger

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

juanchosl/logger
================

Little logger using the PSR interfaces

1.1.3(5mo ago)13785MITPHPPHP ^8.1

Since Jun 26Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/JuanchoSL/Logger)[ Packagist](https://packagist.org/packages/juanchosl/logger)[ Docs](https://github.com/JuanchoSL/Logger)[ RSS](/packages/juanchosl-logger/feed)WikiDiscussions 1.1 Synced today

READMEChangelog (8)Dependencies (3)Versions (12)Used By (5)

Logger
======

[](#logger)

Description
-----------

[](#description)

Little adapter to save log data using PSR3. This library have the availability of put the data log into distincts repositories or with different format. We can change the destination of the data, or his format, only changing the injected dependency.

We can create distincts log for differents cases, save it with an alias into the Debugger instance and call or inject any one into a any lib. In example, we can create a log for database queries, other for debug, other for errors...

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

[](#installation)

Use composer in order to install it

```
composer require juanchosl/logger
composer update
```

How to use
----------

[](#how-to-use)

### First steps

[](#first-steps)

#### Create or use provided Data Composers,

[](#create-or-use-provided-data-composers)

Using composers, you can create and design your own messages structure, you can convert to String (for save into files) or can convert to Array or Objects in order to save into tables.

Actually we have availables 3 types of Composers:

- TextComposer
- ArrayComposer
- ObjectComposer

```
$composer = new TextComposer;
```

#### Create or use a provided repository

[](#create-or-use-a-provided-repository)

Is the message destination, you can use the same Composer for save data to few Repositories, mantaining the same structure for all, create an instance in order to put the composer

Actually we have availables 3 Repositories

- FileRepository (needs to provide a filepath)
- ScreenRepository (do ECHO, converting iterable entities with print\_r, json\_encode, casting to string or performing a var\_dump)
- StreamRepository, as Screen, convert variables, capturing it and send to a stream, as a body from a PSR Response

```
$repository = new FileRepository(PATH . DIRECTORY_SEPARATOR . 'error.log');
$repository->setComposer($composer);
```

### Logger

[](#logger-1)

#### Declare a Logger directly

[](#declare-a-logger-directly)

```
$logger = new JuanchoSL\Logger\Logger($repository);
$logger->error("This is a message error");
```

#### Declare a Logger using the provided Debugger class

[](#declare-a-logger-using-the-provided-debugger-class)

```
use JuanchoSL\Logger\Debugger;

$debugger = Debugger::init();
$debugger->setLogger('errors', $logger);

//.... your code ...

Debugger::get('errors')->error("This is a message error");
```

#### Declaring few Loggers in order to save separated data

[](#declaring-few-loggers-in-order-to-save-separated-data)

```
use JuanchoSL\Logger\Debugger;

$debugger = Debugger::init()
    ->setLogger('errors', $logger)
    ->setLogger('database', new Logger((new ModelRepository())->setComposer(new ObjectComposer)));

//.... your code ...

Debugger::get('errors')?->error("This is a message error");
Debugger::get('database')?->debug($sql);
```

### Error control

[](#error-control)

#### Initializing error or exception handlers

[](#initializing-error-or-exception-handlers)

```
use JuanchoSL\Logger\Debugger;

$debugger = Debugger::init()->setLogger('errors', $logger)->initFailuresHandler('errors', E_ALL^E_USER_NOTICE);
```

### Use declared Loggers for inject as dependecy into Libraries

[](#use-declared-loggers-for-inject-as-dependecy-into-libraries)

```
use JuanchoSL\Logger\Debugger;
use JuanchoSL\Orm\Engine\Drivers\Mysqli;

$debugger = Debugger::init()
    ->setLogger('errors', $logger)
    ->setLogger('database', new Logger((new ModelRepository())->setComposer(new ObjectComposer)))
    ->initFailuresHandler('errors', E_ALL^E_USER_NOTICE);

$database = new Mysqli($credentials);
$database->setLogger($debugger->getLogger('database'));
```

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance71

Regular maintenance activity

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity60

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

Total

10

Last Release

164d ago

PHP version history (2 changes)1.0.0PHP ^7.1 || ^8.0

1.1.1PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/18701207?v=4)[Juan Sánchez](/maintainers/Juanchosl)[@JuanchoSL](https://github.com/JuanchoSL)

---

Top Contributors

[![JuanchoSL](https://avatars.githubusercontent.com/u/18701207?v=4)](https://github.com/JuanchoSL "JuanchoSL (68 commits)")

---

Tags

logdebug

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[sentry/sentry

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

1.9k247.1M335](/packages/sentry-sentry)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69735.1M159](/packages/algolia-algoliasearch-client-php)[pagemachine/typo3-formlog

Form log for TYPO3

23238.6k8](/packages/pagemachine-typo3-formlog)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)

PHPackages © 2026

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