PHPackages                             madeinua/browser-console - 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. madeinua/browser-console

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

madeinua/browser-console
========================

PHP to browser console logging with Laravel integration

2.0(3mo ago)012MITPHPPHP ^8.0

Since Aug 22Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/madeinua/browser-console)[ Packagist](https://packagist.org/packages/madeinua/browser-console)[ RSS](/packages/madeinua-browser-console/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

Browser Console Logger
======================

[](#browser-console-logger)

A simple PHP class to log messages directly to the browser console. PSR-3 Logger Interface compatible with Laravel integration.

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

[](#requirements)

- PHP 8.0 or higher
- PSR-3 Log (psr/log) ^2.0 or ^3.0

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

[](#installation)

```
composer require madeinua/browser-console
```

### Laravel Integration

[](#laravel-integration)

Publish the configuration file (optional):

```
php artisan vendor:publish --tag=browser-console-config
```

Usage
-----

[](#usage)

### Static Method (Quick Usage)

[](#static-method-quick-usage)

```
use BrowserConsole\BrowserConsole;

// Simple message
BrowserConsole::show('Hello World!');

// Output: console.log("Hello World!")
```

### Context Interpolation

[](#context-interpolation)

```
BrowserConsole::show('Hello {user}!', ['user' => 'Mark']);

// Output: console.log("Hello Mark!")
```

### Including Timestamp

[](#including-timestamp)

```
BrowserConsole::show('Hello', [], true);

// Output: console.log("[2024-01-01 15:00:00] Hello")
```

### Different Data Types

[](#different-data-types)

```
// Arrays (displayed as expandable objects in browser console)
BrowserConsole::show(['name' => 'John', 'age' => 30]);
// Output: console.log({"name":"John","age":30})

// Numbers
BrowserConsole::show(42);
// Output: console.log(42)

// Booleans
BrowserConsole::show(true);
// Output: console.log(true)
```

### PSR-3 Logger Interface

[](#psr-3-logger-interface)

```
use BrowserConsole\BrowserConsole;

$logger = new BrowserConsole();

// Different log levels
$logger->emergency('System is down!');
$logger->alert('Alert message');
$logger->critical('Critical error');
$logger->error('Error occurred');
$logger->warning('Warning message');
$logger->notice('Notice');
$logger->info('Information');
$logger->debug('Debug info');

// With context interpolation
$logger->info('User {user} logged in', ['user' => 'John']);
// Output: console.info("User John logged in")
```

### Laravel Facade

[](#laravel-facade)

```
use BrowserConsole\Facades\Console;

Console::info('Information message');
Console::error('Error message');
Console::show(['data' => 'value']);
```

### Laravel Models and Collections

[](#laravel-models-and-collections)

The logger automatically handles Laravel models and collections:

```
use App\Models\User;

// Single model
BrowserConsole::show(User::find(1));

// Collection
BrowserConsole::show(User::all());
```

### Enable/Disable Output

[](#enabledisable-output)

```
$logger = new BrowserConsole(enabled: false);
$logger->info('This will not output anything');

// Or toggle
$logger->setEnabled(true);
$logger->info('Now it outputs');
```

### Laravel Configuration

[](#laravel-configuration)

In your `.env` file:

```
BROWSER_CONSOLE_ENABLED=true  # Set to false in production
```

Or in `config/browser-console.php`:

```
return [
    'enabled' => env('BROWSER_CONSOLE_ENABLED', true),
];
```

Output
------

[](#output)

All messages are output as JavaScript `` tags:

```
console.log("Hello World!")
console.info("Info message")
console.error("Error message")
```

Testing
-------

[](#testing)

```
composer test
```

Or with PHPUnit directly:

```
./vendor/bin/phpunit
```

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

###  Health Score

40

—

FairBetter than 87% of packages

Maintenance85

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

Total

3

Last Release

106d ago

Major Versions

1.1 → 2.02026-01-22

PHP version history (2 changes)1.0PHP ^8.0.0

2.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/ef29a90759fd778e5e423e36bddb4e06fc2cf70bc36fd28f5b7280883d25f71f?d=identicon)[MVDE](/maintainers/MVDE)

---

Top Contributors

[![madeinua](https://avatars.githubusercontent.com/u/8436504?v=4)](https://github.com/madeinua "madeinua (2 commits)")

---

Tags

phpconsolebrowserlaravelloggingdebug

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/madeinua-browser-console/health.svg)

```
[![Health](https://phpackages.com/badges/madeinua-browser-console/health.svg)](https://phpackages.com/packages/madeinua-browser-console)
```

###  Alternatives

[analog/analog

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

3451.5M24](/packages/analog-analog)[hedii/laravel-gelf-logger

A Laravel package to send logs to a gelf compatible backend like graylog

1333.4M10](/packages/hedii-laravel-gelf-logger)[phpconsole/phpconsole

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

417.5k1](/packages/phpconsole-phpconsole)

PHPackages © 2026

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