{"id":37262037,"url":"https://github.com/folded-php/log","last_synced_at":"2026-01-15T23:14:10.173Z","repository":{"id":62506215,"uuid":"296815336","full_name":"folded-php/log","owner":"folded-php","description":"Log information to various channels for your web app. ","archived":false,"fork":false,"pushed_at":"2020-10-17T07:57:33.000Z","size":75,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-01-14T13:54:43.640Z","etag":null,"topics":["logging","monolog","php"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/folded/log","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/folded-php.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-19T07:52:49.000Z","updated_at":"2020-10-12T19:52:03.000Z","dependencies_parsed_at":"2022-11-02T12:31:03.423Z","dependency_job_id":null,"html_url":"https://github.com/folded-php/log","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/folded-php/log","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Flog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Flog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Flog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Flog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/folded-php","download_url":"https://codeload.github.com/folded-php/log/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Flog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28473974,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T22:27:41.514Z","status":"ssl_error","status_checked_at":"2026-01-15T21:54:47.910Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["logging","monolog","php"],"created_at":"2026-01-15T23:14:09.662Z","updated_at":"2026-01-15T23:14:10.167Z","avatar_url":"https://github.com/folded-php.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# folded/log\n\nLog information to various channels for your web app.\n\n[![Packagist License](https://img.shields.io/packagist/l/folded/log)](https://github.com/folded-php/log/blob/master/LICENSE) [![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/folded/log)](https://github.com/folded-php/log/blob/master/composer.json#L14) [![Packagist Version](https://img.shields.io/packagist/v/folded/log)](https://packagist.org/packages/folded/log) [![Build Status](https://travis-ci.com/folded-php/log.svg?branch=master)](https://travis-ci.com/folded-php/log) [![Maintainability](https://api.codeclimate.com/v1/badges/e24be0ab29a9b4119765/maintainability)](https://codeclimate.com/github/folded-php/log/maintainability) [![TODOs](https://img.shields.io/endpoint?url=https://api.tickgit.com/badge?repo=github.com/folded-php/log)](https://www.tickgit.com/browse?repo=github.com/folded-php/log)\n\n## Summary\n\n- [About](#about)\n- [Features](#features)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Examples](#examples)\n- [Version support](#version-support)\n\n## About\n\nI created this package to simply setup Monolog, usable in any projects easily.\n\nFolded is a constellation of packages to help you setting up a web app easily, using ready to plug in packages.\n\n- [folded/action](https://github.com/folded-php/action): A way to organize your controllers for your web app.\n- [folded/config](https://github.com/folded-php/config): Configuration utilities for your PHP web app.\n- [folded/crypt](https://github.com/folded-php/crypt): Encrypt and decrypt strings for your web app.\n- [folded/exception](https://github.com/folded-php/exception): Various kind of exception to throw for your web app.\n- [folded/history](https://github.com/folded-php/history): Manipulate the browser history for your web app.\n- [folded/http](https://github.com/folded-php/http): HTTP utilities for your web app.\n- [folded/orm](https://github.com/folded-php/orm): An ORM for you web app.\n- [folded/session](https://github.com/folded-php/session): Session functions for your web app.\n- [folded/request](https://github.com/folded-php/request): Request utilities, including a request validator, for your PHP web app.\n- [folded/routing](https://github.com/folded-php/routing): Routing functions for your PHP web app.\n- [folded/view](https://github.com/folded-php/view): View utilities for your PHP web app.\n\n## Features\n\n- Uses [monolog/monolog](https://github.com/Seldaek/monolog)\n- Can add multiple \"write channels\" (example: file, ...) to the same logger\n- Supports the following channels:\n  - File (e.g. StreamHandler)\n\n## Requirements\n\n- PHP version \u003e= 7.4.0\n- Composer installed\n\n## Installation\n\n- [1. Install the package](#1-install-the-package)\n- [2. Add the setup code](#2-add-the-setup-code)\n\n### 1. Install the package\n\nIn your root folder, run this command:\n\n```bash\ncomposer require folded/log\n```\n\n## Examples\n\n- [1. Log a debug message to a file](#1-log-a-debug-message-to-a-file)\n- [2. Add extra parameters when logging](#2-add-extra-parameters-when-logging)\n- [3. Log by choosing your severity manually](#3-log-by-choosing-your-severity-manually)\n- [4. Add another channel to the same logger](#4-add-another-channel-to-the-same-logger)\n\n### 1. Create a file logger\n\nIn this example, we will create a file logger, and then we will log a debug information into our log file.\n\n```php\nuse function Folded\\addLogger;\nuse function Folded\\addDebugLog;\n\naddLogger(\"myLogger\", \"file\", [\n  \"path\" =\u003e __DIR__ . \"/logs/my-file.log\",\n]);\n\naddDebugLog(\"myLogger\", \"This is my first debug log!\");\n```\n\nNote that if you want to avoid typos, you can use constants for defining the file channel.\n\n```php\nuse function Folded\\addLogger;\nuse function Folded\\addDebugLog;\nuse const Folded\\CHANNEL_FILE;\n\naddLogger(\"myLogger\", CHANNEL_FILE, [\n  \"path\" =\u003e __DIR__ . \"/logs/my-file.log\",\n]);\n\naddDebugLog(\"myLogger\", \"This is my first debug log!\");\n```\n\nFor the moment, there is only one channel:\n\n```php\nuse const Folded\\CHANNEL_FILE;\n```\n\nYou can log various severities. Here is all the log methods available:\n\n- addAlertLog\n- addCriticalLog\n- addDebugLog\n- addEmergencyLog\n- addErrorLog\n- addInfoLog\n- addNoticeLog\n- addWarningLog\n\n### 2. Add extra parameters when logging\n\nIn this example, we will push extra data as key-value pairs alongisde our log message.\n\n```php\nuse function Folded\\addLogger;\nuse function Folded\\addDebugLog;\n\naddLogger(\"myLogger\", \"file\", [\n  \"path\" =\u003e __DIR__ . \"/logs/my-file.log\",\n]);\n\naddDebugLog(\"myLogger\", \"a user has registered\", [\n  \"timestamp\" =\u003e 1577836800,\n]);\n```\n\n### 3. Log by choosing your severity manually\n\nIn this example, we will use a `addLog` function, which let us choose the severity using a string for more flexibility.\n\n```php\nuse function Folded\\addLogger;\nuse function Folded\\addLog;\n\naddLogger(\"myLogger\", \"file\", [\n  \"path\" =\u003e __DIR__ . \"/logs/neutral.log\",\n]);\n\naddLog(\"myLogger\", \"warning\", \"User email invalid\");\n```\n\nNote you can use severity constants provided by this library if you want to avoid typos:\n\n```php\nuse function Folded\\addLogger;\nuse function Folded\\addLog;\nuse const Folded\\SEVERITY_WARNING;\n\naddLogger(\"myLogger\", \"file\", [\n  \"path\" =\u003e __DIR__ . \"/logs/neutral.log\",\n]);\n\naddLog(\"myLogger\", SEVERITY_WARNING, \"User email invalid\");\n```\n\nHere is a complete list of severities you can use:\n\n```php\nuse const Folded\\SEVERITY_ALERT;\nuse const Folded\\SEVERITY_CRITICAL;\nuse const Folded\\SEVERITY_DEBUG;\nuse const Folded\\SEVERITY_EMERGENCY;\nuse const Folded\\SEVERITY_ERROR;\nuse const Folded\\SEVERITY_INFO;\nuse const Folded\\SEVERITY_NOTICE;\nuse const Folded\\SEVERITY_WARNING;\n```\n\n### 4. Add another channel to the same logger\n\nIn this example, our logger will log to 2 differents files.\n\n```php\nuse function Folded\\addLogger;\nuse function Folded\\addLoggerChannel;\n\naddLogger(\"myLogger\");\n\n// First file\naddLoggerChannel(\"myLogger\", \"file\", [\n  \"path\" =\u003e \"path/to/file-1.log\",\n]);\n\n// Second file\naddLoggerChannel(\"myLogger\", \"file\", [\n  \"path\" =\u003e \"path/to/file-2.log\",\n]);\n```\n\nNow, everytime you call a log method like `addDebugLog()`, the log will be written in these two files.\n\nThis 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.\n\n## Version support\n\n|        | 7.3 | 7.4 | 8.0 |\n| ------ | --- | --- | --- |\n| v0.1.0 | ❌  | ✔️  | ❓  |\n| v0.1.1 | ❌  | ✔️  | ❓  |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffolded-php%2Flog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffolded-php%2Flog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffolded-php%2Flog/lists"}