PHPackages                             miladrahimi/phplogger - 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. miladrahimi/phplogger

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

miladrahimi/phplogger
=====================

Free PHP logger for neat and powerful projects!

1.6(10y ago)637MITPHPPHP &gt;=5.3.0

Since May 19Pushed 7y ago1 watchersCompare

[ Source](https://github.com/miladrahimi/phplogger)[ Packagist](https://packagist.org/packages/miladrahimi/phplogger)[ Docs](http://miladrahimi.github.io/phplogger)[ RSS](/packages/miladrahimi-phplogger/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (1)Versions (10)Used By (0)

PHPLogger
=========

[](#phplogger)

A simple logger for php projects

Overview
--------

[](#overview)

PHP Logger is a simple package for PHP developers to log. It is implemented based on [PSR-3](http://www.php-fig.org/psr/psr-3) Standard.

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

[](#installation)

### Using Composer (Recommended)

[](#using-composer-recommended)

Read [How to use composer in php projects](http://miladrahimi.com/blog/2015/04/12/how-to-use-composer-in-php-projects)article if you are not familiar with [Composer](http://getcomposer.org).

Run following command in your project root directory:

```
composer require miladrahimi/phplogger

```

### Manually

[](#manually)

You may use your own autoloader as long as it follows [PSR-0](http://www.php-fig.org/psr/psr-0) or [PSR-4](http://www.php-fig.org/psr/psr-4) standards. Just put `src` directory contents in your vendor directory.

Getting Started
---------------

[](#getting-started)

PHPLogger has potential to store logs into different kinds of storage, but for now you can only use directory (filesystem) to store them. Following codes illustrate how to define a directory storage and inject it to Logger class:

```
use MiladRahimi\PHPLogger\Logger;
use MiladRahimi\PHPLogger\Directory;

$dir = new Directory("./logs/");
$logger = new Logger($dir);

```

As you see in the code snippet above, you can inject storage via Logger constructor, but if you want to use more storage, you may add them via following method:

```
$logger->addStorage($my_storage);

```

Now you may store your first log:

```
$logger->alert("This is an alert!");

```

Alert is not only supported log level out of the box, you may see all supported log level out there in [PSR-3](http://www.php-fig.org/psr/psr-3) page.

Log method
----------

[](#log-method)

The broader method for logging is `Logger::log()` method which catches log level as its first parameter. Following example show how to use this method:

```
use MiladRahimi\PHPLogger\Logger;
use MiladRahimi\PHPLogger\Directory;

$directory = new Directory(__DIR__);
$logger = new Logger($directory);
$logger->log("alert", "This is an alert message!");

```

To follow standards you may use `LogLevel` constants which are provided by PSR-3 standard.

```
use MiladRahimi\PHPLogger\Logger;
use MiladRahimi\PHPLogger\Directory;
use Psr\Log\LogLevel;

$logger = new Logger(new Directory(__DIR__));
$logger->log(LogLevel::ALERT, "This is an error message!");

```

Context
-------

[](#context)

Context is the third parameter in `Logger::log()` method and second one for direct level log methods like `Log::alert()`. This parameter can be an array or an object which you may use to store more details alongside your log message.

License
-------

[](#license)

PHPLogger is created by [Milad Rahimi](http://miladrahimi.com)and released under the [MIT License](http://opensource.org/licenses/mit-license.php).

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 87.5% 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 ~13 days

Total

8

Last Release

3924d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/921274b8bb29236d8f94f6c83100a5f751f6394c4c49741e1b92bfbccac0911b?d=identicon)[miladrahimi](/maintainers/miladrahimi)

---

Top Contributors

[![miladrahimi](https://avatars.githubusercontent.com/u/6689295?v=4)](https://github.com/miladrahimi "miladrahimi (21 commits)")[![atailouloute](https://avatars.githubusercontent.com/u/11352491?v=4)](https://github.com/atailouloute "atailouloute (2 commits)")[![vladdeSV](https://avatars.githubusercontent.com/u/7542961?v=4)](https://github.com/vladdeSV "vladdeSV (1 commits)")

---

Tags

loggerphppsr-3phplibraryloggerpowerfulfreeneat

### Embed Badge

![Health badge](/badges/miladrahimi-phplogger/health.svg)

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

###  Alternatives

[markrogoyski/simplelog-php

Powerful PSR-3 logging. So easy, it's simple.

2818.1k4](/packages/markrogoyski-simplelog-php)[opengento/module-webapi-logger

This module allows you to analyze all the webapi rest done call toward your Magento.

1014.9k](/packages/opengento-module-webapi-logger)

PHPackages © 2026

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