PHPackages                             xy2z/aclog - 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. xy2z/aclog

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

xy2z/aclog
==========

Simple PHP file-logger with zero-dependencies

2.1.0(3y ago)470[1 issues](https://github.com/xy2z/AcLog/issues)MITPHP

Since Dec 20Pushed 3y ago3 watchersCompare

[ Source](https://github.com/xy2z/AcLog)[ Packagist](https://packagist.org/packages/xy2z/aclog)[ RSS](/packages/xy2z-aclog/feed)WikiDiscussions master Synced today

READMEChangelog (7)Dependencies (3)Versions (8)Used By (0)

AcLog
=====

[](#aclog)

AcLog is a simple, zero-dependency PHP package to log activity to files.

AcLog can be used to easily log actions such as cronjobs, emails, user activity, details about errors, etc.

*🧡 Sponsored by **[Datsi.app - Your personal database](https://datsi.app/)**.*

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

[](#requirements)

- PHP 8.0+

Install
-------

[](#install)

Add this to your existing project:

```
composer require xy2z/aclog

```

Basic Usage
-----------

[](#basic-usage)

```
use xy2z\AcLog\AcLog;

$aclog = new AcLog(__DIR__ . '/logs');
$aclog->log($var); // can be any type: object, array, string, int, etc.
$aclog->log($var, $foo, $bar, $etc); // as many arguments you want.
```

### Set Options

[](#set-options)

```
$aclog = new AcLog(
    log_dir: __DIR__ . '/logs',
    log_date_format: false,
    include_trace: false,
    output_method: AcLog::VAR_DUMP,
    line_breaks_between_header: 4,
    // etc.
);
```

For more options see the constructor method of the [AcLog.php](https://github.com/xy2z/AcLog/blob/master/src/AcLog.php) file.

### Static Class

[](#static-class)

It is also possible to use it as a static class, if you prefer.

```
use xy2z\AcLog\AcLogStatic;

AcLogStatic::setup(__DIR__ . '/logs');
AcLogStatic::log($var);
```

If you want to set options in the static class, you need to set them as an array.

```
AcLogStatic::setup([
    'log_dir' => __DIR__ . '/logs',
    'log_date_format' => false,
    'include_trace' => false,
    'output_method' => AcLog::VAR_DUMP,
    'line_breaks_between_header' => 4,
    // etc.
]);
```

Other than that, it should behave exactly the same as the AcLog class, and all public methods and properties are also available.

#### Static Alias

[](#static-alias)

If you want a shorter name for the static class, you can alias it.

```
use xy2z\AcLog\AcLogStatic as acl;

acl::setup(__DIR__ . '/logs');
acl::log($var);
```

### Log Callbacks

[](#log-callbacks)

You can add callbacks that will be appended to each `log()` call, examples for this can be user information, request headers, etc. You can add as many callbacks you want.

```
$aclog = new AcLog($this->logdir);

$aclog->add_log_append_callback(function () {
    return 'callback-1.';
});

$aclog->add_log_append_callback(array('MyClass', 'myCallbackMethod'));
```

Tips
----

[](#tips)

- Consider to zip (7zip is best) the log files after a few days - it will save ALOT of diskspace.

---

Developing
----------

[](#developing)

Pull Requests are welcome, just make sure your code is tested, analysed and fixed - see below.

Remember to make tests for both classes: `AcLog` and `AcLogStatic`.

```
# Fix Coding Standards (php-cs-fixer)
composer fix

# Analyse code (phpstan)
composer analyse

# Test code (phpunit)
composer test

```

### Todo

[](#todo)

- badges
- Later: Method for getting options values
- examples dir?

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

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

Recently: every ~132 days

Total

7

Last Release

1114d ago

Major Versions

1.1.1 → 2.0.02022-07-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/5d4c08a97e1c9c53efb123c306f551fcb367e8adea3bfa1412c49c8e5133aeff?d=identicon)[xy2z](/maintainers/xy2z)

---

Top Contributors

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

---

Tags

actionsactvitylightweightlogloggerloggingphpzero-dependency

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/xy2z-aclog/health.svg)

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

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B11.5k](/packages/psr-log)[open-telemetry/api

API for OpenTelemetry PHP.

1941.5M275](/packages/open-telemetry-api)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2328.5M342](/packages/open-telemetry-sdk)

PHPackages © 2026

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