PHPackages                             nyratas/php-console-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. nyratas/php-console-log

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

nyratas/php-console-log
=======================

Displays var\_dump()s in the browser's JavaScript console.

v1.1.0(10y ago)74141MITPHP &gt;=5.3.0

Since May 26Compare

[ Source](https://github.com/toonvandenbos/php-console-log)[ Packagist](https://packagist.org/packages/nyratas/php-console-log)[ Docs](https://github.com/Nyratas/php-console-log)[ RSS](/packages/nyratas-php-console-log/feed)WikiDiscussions Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (1)

PHP console.log()
=================

[](#php-consolelog)

PHP console.log() allows you to dump PHP variables in the browser's console. It is an easy-to-use and lightweight PHP library.

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

[](#installation)

### With Composer

[](#with-composer)

```
composer require nyratas/php-console-log
```

### Manually

[](#manually)

Just download/clone this repository and `require` the autoload file:

```
require_once(__DIR__ . '/PHPConsoleLog/__autoload.php');
```

Usage
-----

[](#usage)

More detailed working examples can be found in the `./examples/` directory.

Don't forget to `use` the library's facade:

```
use PHPConsoleLog\Service as Console;
```

### Basic PHP console.log()

[](#basic-php-consolelog)

Define a place where the library should output the console logs:

```
Console::exec();
```

You can now use the `Console::log()` method everywhere, as long as it is called before a `Console::exec()` call.

```
$myArray = ['one','two','three'];

Console::log($myArray);
```

You can use `Console::log()` with any type of variable. If you want to output an PHP array or object, the library will show a JavaScript Array or Object in the browser's console. A boolean will remain a boolean, an integer will remain an integer, a string remain a string, and so on.

### Edit the `` tag

[](#edit-the-script-tag)

All this library does is generating a ``-tag at the location of the `Console::exec()` call.

This tag contains the required JavaScript logic in order to output the requested data in the browser's console. There is not much you can do on the generated JavaScript code, but you could want to add an attribute on the `` tag.

The library generates the following default HTML markup:

```

      [...]

```

You can remove or modify the `data-php-console-log` attribute by setting it as follows:

```
/*
 * Remove the attribute :
 */

Console::setAttribute();
      // or
Console::setAttribute(false);

/*
 * Edit the attribute :
 */

      // simple attribute
Console::setAttribute('data-my-attribute');
      // attribute with value
Console::setAttribute('data-my-attribute','attribute-value');
```

Wordpress tip
-------------

[](#wordpress-tip)

Do you want to use this library on a wordpress theme ? Just add the following line in your `functions.php` file and start `Console::log()`-ing right now !

```
add_action( 'wp_footer', function(){ Console::exec(); }, 100 );
```

What now ?
----------

[](#what-now-)

Well, I wrote this library in a hurry, so there's probably a lot to change/add. Feel free to contribute or to request some changes.

Enjoy!

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3688d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8435657?v=4)[Whitecube](/maintainers/Whitecube)[@whitecube](https://github.com/whitecube)

---

Top Contributors

[![toonvandenbos](https://avatars.githubusercontent.com/u/5635557?v=4)](https://github.com/toonvandenbos "toonvandenbos (18 commits)")

---

Tags

logphpconsoleloggingjavascriptdebugerrorvar\_dumpconsole.log

### Embed Badge

![Health badge](/badges/nyratas-php-console-log/health.svg)

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

###  Alternatives

[analog/analog

Fast, flexible, easy PSR-3-compatible PHP logging package with dozens of handlers.

3511.6M24](/packages/analog-analog)[justbetter/magento2-sentry

Magento 2 Logger for Sentry

1861.6M3](/packages/justbetter-magento2-sentry)[phpconsole/phpconsole

A detached logging facility for PHP to aid your daily development routine

417.5k1](/packages/phpconsole-phpconsole)[e2ex/e2ex

Converts PHP Errors to Exceptions and (optionally) logs PHP Errors, Notices and Warnings with a PSR-3 compatible logger

101.5k](/packages/e2ex-e2ex)

PHPackages © 2026

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