PHPackages                             onnerby/doelogger - 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. onnerby/doelogger

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

onnerby/doelogger
=================

JSON log writer/reader

1.0(3y ago)04MITPHP

Since Jan 2Pushed 3y ago1 watchersCompare

[ Source](https://github.com/onnerby/doelogger)[ Packagist](https://packagist.org/packages/onnerby/doelogger)[ Docs](https://github.com/onnerby/doelogger)[ RSS](/packages/onnerby-doelogger/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

doelogger
=========

[](#doelogger)

A JSON logger for PHP Sometimes you need to log stuff - but you may need to read the log later on and be able to intepret the content of the log in a nice way. This is where JSON is perfect since you can serialize and deserialize in a simple way. The log uses file locks to prevent corrupt files.

\\Doe\\Logger
-------------

[](#doelogger-1)

The Doe\\Logger is designer to make it super simple to log data and also to read the log.

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

[](#installation)

```
composer require onnerby/doelogger

```

### Basic example

[](#basic-example)

```
// Initialize the log by
\Doe\Logger::addDefaultStream('/var/log/mylog')

// The anywhere in your code
\Doe\Logger::write('adduser', 'Added a new user', $user);
```

This will make a log entry `adduser` with the data provided. The logger will create a file at `/var/log/mylog_2023-01-02.json` (if it's not there already) and write a json entry in that log looking something like this

```
{
	"when": 1672656212.123,
	"type": "adduser",
	"content": [
		...
	]
}
```

### Reading

[](#reading)

```
// Initialize the log by
\Doe\Logger::addDefaultStream('/var/log/mylog')

// Get a reader for the last 24 hours
$logReader = \Doe\Logger::reader('default', microtime(true) - 60*60*24);

// Loop through the log
foreach ($logReader as $logEntry) {
	echo "Log " . date('Y-m-d H:i:s', $logEntry['when']) . ' ' . $logEntry['type'] . "\n";
	echo "  User: " . json_encode($logEntry['content'][0]) . "\n";
}
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

1229d ago

### Community

Maintainers

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

---

Top Contributors

[![onnerby](https://avatars.githubusercontent.com/u/1788794?v=4)](https://github.com/onnerby "onnerby (3 commits)")

---

Tags

phplogging

### Embed Badge

![Health badge](/badges/onnerby-doelogger/health.svg)

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

###  Alternatives

[hedii/laravel-gelf-logger

A Laravel package to send logs to a gelf compatible backend like graylog

1333.4M10](/packages/hedii-laravel-gelf-logger)[justbetter/magento2-sentry

Magento 2 Logger for Sentry

1851.5M3](/packages/justbetter-magento2-sentry)[logtail/monolog-logtail

Logtail handler for Monolog

233.2M3](/packages/logtail-monolog-logtail)

PHPackages © 2026

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