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

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

folded/log
==========

Log information to various channels for your web app.

v0.1.2(5y ago)013[1 issues](https://github.com/folded-php/log/issues)MITPHPPHP &gt;=7.4.0

Since Sep 19Pushed 5y ago2 watchersCompare

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

READMEChangelogDependencies (4)Versions (4)Used By (0)

folded/log
==========

[](#foldedlog)

Log information to various channels for your web app.

[![Packagist License](https://camo.githubusercontent.com/d93d2ea4e397de5603560fd7122d616c22d0c6fd027562689c042c00fc55d1a6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f666f6c6465642f6c6f67)](https://github.com/folded-php/log/blob/master/LICENSE) [![Packagist PHP Version Support](https://camo.githubusercontent.com/63f1faccc5c55792e74791dea14522c28388b882501ce82bb2ca040c74b6fea5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f666f6c6465642f6c6f67)](https://github.com/folded-php/log/blob/master/composer.json#L14) [![Packagist Version](https://camo.githubusercontent.com/7673f58eb97b1246af1714d4b9c3d7a1976c75b00b6cbfe6739f7fff7d4f09d4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666f6c6465642f6c6f67)](https://packagist.org/packages/folded/log) [![Build Status](https://camo.githubusercontent.com/36094d4d7146c7e3ee787a0942f1caf1ef3e6f37c28d62d274bae498c4f53eb2/68747470733a2f2f7472617669732d63692e636f6d2f666f6c6465642d7068702f6c6f672e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/folded-php/log) [![Maintainability](https://camo.githubusercontent.com/bc436e745cd4df279be5645a6d9ba202cafbedae44c814771a98940d80286547/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f65323462653061623239613962343131393736352f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/folded-php/log/maintainability) [![TODOs](https://camo.githubusercontent.com/07d51d3c9710ae9e3f7354f8f5b79db14dd92426408afa036a66f4a15a94d959/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f75726c3d68747470733a2f2f6170692e7469636b6769742e636f6d2f62616467653f7265706f3d6769746875622e636f6d2f666f6c6465642d7068702f6c6f67)](https://www.tickgit.com/browse?repo=github.com/folded-php/log)

Summary
-------

[](#summary)

- [About](#about)
- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Examples](#examples)
- [Version support](#version-support)

About
-----

[](#about)

I created this package to simply setup Monolog, usable in any projects easily.

Folded is a constellation of packages to help you setting up a web app easily, using ready to plug in packages.

- [folded/action](https://github.com/folded-php/action): A way to organize your controllers for your web app.
- [folded/config](https://github.com/folded-php/config): Configuration utilities for your PHP web app.
- [folded/crypt](https://github.com/folded-php/crypt): Encrypt and decrypt strings for your web app.
- [folded/exception](https://github.com/folded-php/exception): Various kind of exception to throw for your web app.
- [folded/history](https://github.com/folded-php/history): Manipulate the browser history for your web app.
- [folded/http](https://github.com/folded-php/http): HTTP utilities for your web app.
- [folded/orm](https://github.com/folded-php/orm): An ORM for you web app.
- [folded/session](https://github.com/folded-php/session): Session functions for your web app.
- [folded/request](https://github.com/folded-php/request): Request utilities, including a request validator, for your PHP web app.
- [folded/routing](https://github.com/folded-php/routing): Routing functions for your PHP web app.
- [folded/view](https://github.com/folded-php/view): View utilities for your PHP web app.

Features
--------

[](#features)

- Uses [monolog/monolog](https://github.com/Seldaek/monolog)
- Can add multiple "write channels" (example: file, ...) to the same logger
- Supports the following channels:
    - File (e.g. StreamHandler)

Requirements
------------

[](#requirements)

- PHP version &gt;= 7.4.0
- Composer installed

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

[](#installation)

- [1. Install the package](#1-install-the-package)
- [2. Add the setup code](#2-add-the-setup-code)

### 1. Install the package

[](#1-install-the-package)

In your root folder, run this command:

```
composer require folded/log
```

Examples
--------

[](#examples)

- [1. Log a debug message to a file](#1-log-a-debug-message-to-a-file)
- [2. Add extra parameters when logging](#2-add-extra-parameters-when-logging)
- [3. Log by choosing your severity manually](#3-log-by-choosing-your-severity-manually)
- [4. Add another channel to the same logger](#4-add-another-channel-to-the-same-logger)

### 1. Create a file logger

[](#1-create-a-file-logger)

In this example, we will create a file logger, and then we will log a debug information into our log file.

```
use function Folded\addLogger;
use function Folded\addDebugLog;

addLogger("myLogger", "file", [
  "path" => __DIR__ . "/logs/my-file.log",
]);

addDebugLog("myLogger", "This is my first debug log!");
```

Note that if you want to avoid typos, you can use constants for defining the file channel.

```
use function Folded\addLogger;
use function Folded\addDebugLog;
use const Folded\CHANNEL_FILE;

addLogger("myLogger", CHANNEL_FILE, [
  "path" => __DIR__ . "/logs/my-file.log",
]);

addDebugLog("myLogger", "This is my first debug log!");
```

For the moment, there is only one channel:

```
use const Folded\CHANNEL_FILE;
```

You can log various severities. Here is all the log methods available:

- addAlertLog
- addCriticalLog
- addDebugLog
- addEmergencyLog
- addErrorLog
- addInfoLog
- addNoticeLog
- addWarningLog

### 2. Add extra parameters when logging

[](#2-add-extra-parameters-when-logging)

In this example, we will push extra data as key-value pairs alongisde our log message.

```
use function Folded\addLogger;
use function Folded\addDebugLog;

addLogger("myLogger", "file", [
  "path" => __DIR__ . "/logs/my-file.log",
]);

addDebugLog("myLogger", "a user has registered", [
  "timestamp" => 1577836800,
]);
```

### 3. Log by choosing your severity manually

[](#3-log-by-choosing-your-severity-manually)

In this example, we will use a `addLog` function, which let us choose the severity using a string for more flexibility.

```
use function Folded\addLogger;
use function Folded\addLog;

addLogger("myLogger", "file", [
  "path" => __DIR__ . "/logs/neutral.log",
]);

addLog("myLogger", "warning", "User email invalid");
```

Note you can use severity constants provided by this library if you want to avoid typos:

```
use function Folded\addLogger;
use function Folded\addLog;
use const Folded\SEVERITY_WARNING;

addLogger("myLogger", "file", [
  "path" => __DIR__ . "/logs/neutral.log",
]);

addLog("myLogger", SEVERITY_WARNING, "User email invalid");
```

Here is a complete list of severities you can use:

```
use const Folded\SEVERITY_ALERT;
use const Folded\SEVERITY_CRITICAL;
use const Folded\SEVERITY_DEBUG;
use const Folded\SEVERITY_EMERGENCY;
use const Folded\SEVERITY_ERROR;
use const Folded\SEVERITY_INFO;
use const Folded\SEVERITY_NOTICE;
use const Folded\SEVERITY_WARNING;
```

### 4. Add another channel to the same logger

[](#4-add-another-channel-to-the-same-logger)

In this example, our logger will log to 2 differents files.

```
use function Folded\addLogger;
use function Folded\addLoggerChannel;

addLogger("myLogger");

// First file
addLoggerChannel("myLogger", "file", [
  "path" => "path/to/file-1.log",
]);

// Second file
addLoggerChannel("myLogger", "file", [
  "path" => "path/to/file-2.log",
]);
```

Now, everytime you call a log method like `addDebugLog()`, the log will be written in these two files.

This is very powerful when this library will be able to provide with different kind of channels, so you will be able to write both in a file and in your Syslog channel for example.

Version support
---------------

[](#version-support)

7.37.48.0v0.1.0❌✔️❓v0.1.1❌✔️❓

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity46

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

Every ~6 days

Total

3

Last Release

2053d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15908747?v=4)[Anwar](/maintainers/khalyomede)[@khalyomede](https://github.com/khalyomede)

---

Top Contributors

[![khalyomede](https://avatars.githubusercontent.com/u/15908747?v=4)](https://github.com/khalyomede "khalyomede (17 commits)")

---

Tags

loggingmonologphp

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[symfony/monolog-bridge

Provides integration for Monolog with various Symfony components

2.6k189.7M258](/packages/symfony-monolog-bridge)[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)[honeybadger-io/honeybadger-php

Honeybadger PHP library

381.5M4](/packages/honeybadger-io-honeybadger-php)[graycore/magento2-stdlogging

A Magento 2 module that changes all logging handlers to stdout

2382.6k](/packages/graycore-magento2-stdlogging)

PHPackages © 2026

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