PHPackages                             phpconsolelog/phpconsolelog - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. phpconsolelog/phpconsolelog

ActiveLibrary[HTTP &amp; Networking](/categories/http)

phpconsolelog/phpconsolelog
===========================

Real-time console logging for PHP applications with WebSocket support

v1.0.3(5mo ago)013MITPHPPHP &gt;=7.4

Since Dec 14Pushed 5mo agoCompare

[ Source](https://github.com/chrismaroulis/phpconsolelog)[ Packagist](https://packagist.org/packages/phpconsolelog/phpconsolelog)[ RSS](/packages/phpconsolelog-phpconsolelog/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (5)Used By (0)

PHPConsoleLog
=============

[](#phpconsolelog)

Real-time console logging for PHP applications with WebSocket support. Debug your PHP code with the same ease as using `console.log()` in JavaScript!

> **Disclaimer:** This entire repository, including all code and implementation, was initially created with Cursor and Claude Sonnet 4.5. Only the prompt was made by Chris Maroulis.

[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)[![PHP Version](https://camo.githubusercontent.com/6eff5053a32c9e0bcc0982c4f118ef689cad7831a3d982767aae3901bf67313c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344372e342d626c75652e737667)](https://php.net)

Features
--------

[](#features)

✨ **Real-time Streaming** - See your logs instantly in a browser window via WebSockets
🎨 **Color-Coded Levels** - Debug, Info, Warning, and Error with visual distinction
📦 **Multiple Data Types** - Log strings, arrays, objects, exceptions, and more
🔄 **Non-Blocking** - Async log sending won't slow down your application
🌐 **Framework Agnostic** - Works with any PHP application or framework
👥 **Multiple Viewers** - Several developers can watch the same log stream
💾 **Buffered History** - New viewers see the last 100 messages immediately
🧹 **Clear Console** - Reset the log view with one click

Why PHPConsoleLog?
------------------

[](#why-phpconsolelog)

Traditional PHP debugging often involves:

- Using `var_dump()` or `print_r()` which breaks your application's output
- Tailing log files with `tail -f`
- Installing heavy debugging tools like Xdebug
- Breaking AJAX responses with debug output

PHPConsoleLog provides a lightweight, real-time alternative that doesn't interfere with your application's output.

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

[](#installation)

Install via Composer:

```
composer require phpconsolelog/phpconsolelog
```

### Quick Deployment

[](#quick-deployment)

After installation, copy the boilerplate files to your project root:

```
# Copy the server file
cp vendor/phpconsolelog/phpconsolelog/server.php .

# Copy the launcher scripts (choose what you need)
cp vendor/phpconsolelog/phpconsolelog/start-server.bat .      # Windows
cp vendor/phpconsolelog/phpconsolelog/start-server.ps1 .      # PowerShell
cp vendor/phpconsolelog/phpconsolelog/start-server.sh .       # Linux/Mac

# Make the shell script executable (Linux/Mac)
chmod +x start-server.sh
```

That's it! Now you can start the server with a simple command.

Quick Start
-----------

[](#quick-start)

### 1. Start the Server

[](#1-start-the-server)

**Option A: Use the simple boilerplate (recommended for users)**

Copy `server.php` to your project and run one of these commands:

```
# Windows (Command Prompt)
start-server.bat

# Windows (PowerShell)
.\start-server.ps1

# Linux/Mac
./start-server.sh

# Or directly with PHP (all platforms)
php server.php
```

**Option B: Run from vendor directory (for development/testing)**

```
php vendor/phpconsolelog/phpconsolelog/examples/server-start.php
```

The server will start on `http://localhost:8080` by default.

### 2. Open the Viewer

[](#2-open-the-viewer)

Open your browser and navigate to:

```
http://localhost:8080/viewer/your-unique-key

```

Replace `your-unique-key` with any identifier for your logging session (e.g., your project name).

### 3. Use in Your Application

[](#3-use-in-your-application)

```
