PHPackages                             coccoinomane/phpunit-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. [Testing &amp; Quality](/categories/testing)
4. /
5. coccoinomane/phpunit-log

ActiveLibrary[Testing &amp; Quality](/categories/testing)

coccoinomane/phpunit-log
========================

Log from within your PHPUnit tests.

1.0.3(3y ago)01.5k↓50%1GPL-3.0-or-laterPHP

Since Feb 2Pushed 3y ago1 watchersCompare

[ Source](https://github.com/coccoinomane/phpunit-log)[ Packagist](https://packagist.org/packages/coccoinomane/phpunit-log)[ Docs](https://github.com/coccoinomane/phpunit-log)[ RSS](/packages/coccoinomane-phpunit-log/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (1)

Defines the `Loggable` trait to log from within your PHPUnit tests.

Usage
=====

[](#usage)

1. Install the package with `composer require --dev coccoinomane/phpunit-log`.
2. Include the trait in your TestCase with `\use PHPUnitLog\Loggable;`.
3. Start logging with `this->log( $message )` or `this->print( $message )`.

Features
========

[](#features)

- To log a message to screen, call `self::print( $message )`.
- To log a message to file, call `self::log( $message )`.
- The file will be named after the test class and placed in the subfolder *tests/logs*.
- Customize the log folder via the `logsPath` environment variable.
- To delete the log files before each run: ```
    public static function setUpBeforeClass(): void {
      static::deleteLogFile();
    }
    ```
- For further customizations, see the docs in [`Loggable`](./src/Loggable.php) or the tests in [`LoggableTest`](./tests/LoggableTest.php).

The `Loggable` trait is used by [`WordPressTestCase`](https://github.com/idearia/wp-tests).

Custom folder for the logs
==========================

[](#custom-folder-for-the-logs)

By default, the log files will be placed in the *tests/logs* folder; set the `logsPath` environment variable to use a different folder. You can use both relative and absolute paths.

To set `logsPath` in *phpunit.xml*:

```

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity48

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

Total

4

Last Release

1202d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/17342951?v=4)[Idearia SRL](/maintainers/idearia)[@Idearia](https://github.com/Idearia)

---

Top Contributors

[![coccoinomane](https://avatars.githubusercontent.com/u/3920436?v=4)](https://github.com/coccoinomane "coccoinomane (1 commits)")

---

Tags

phpphpunittraittests

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[hot/phpunit-runner

The lib allows to watch phpunit tests

3066.9k4](/packages/hot-phpunit-runner)[aik099/phpunit-mink

Library for using Mink in PHPUnit tests. Supports session sharing between tests in a test case.

72136.2k1](/packages/aik099-phpunit-mink)[phpunit/phpunit-dom-assertions

DOM assertions for PHPUnit

29343.5k11](/packages/phpunit-phpunit-dom-assertions)[janmarek/mockista

Mockista is library for mocking, which I've written, because I find mocking in PHPUnit awful.

29221.0k28](/packages/janmarek-mockista)[robiningelbrecht/phpunit-coverage-tools

PHPUnit coverage tools

1783.0k34](/packages/robiningelbrecht-phpunit-coverage-tools)[phrozenbyte/phpunit-array-asserts

Provides various array-related PHPUnit assertions, primarily used for API testing.

1055.0k1](/packages/phrozenbyte-phpunit-array-asserts)

PHPackages © 2026

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