PHPackages                             yaknet/lighthouse - 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. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. yaknet/lighthouse

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

yaknet/lighthouse
=================

A lightweight, zero-dependency performance profiler and CLI/HTML flamegraph renderer for PHP.

v1.0.1(1mo ago)00MITPHPPHP &gt;=8.2

Since Jun 12Pushed 3w agoCompare

[ Source](https://github.com/y-packages/lighthouse)[ Packagist](https://packagist.org/packages/yaknet/lighthouse)[ RSS](/packages/yaknet-lighthouse/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

YakNet Lighthouse 🕯️ (Lightweight PHP Performance Profiler)
===========================================================

[](#yaknet-lighthouse-️-lightweight-php-performance-profiler)

[![PHP Version](https://camo.githubusercontent.com/c5e8da782b1a0673c08b4f474108036d2cc973470eed2d5d89d48e8c8475eee6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e322d626c75652e737667)](https://php.net)[![License](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](LICENSE)[![Aesthetics](https://camo.githubusercontent.com/82b9164c4ee6caebbd2f1f74aeef683fff49226ccf7ca0fe551cc5bee3052c4a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f64657369676e2d7072656d69756d2d707572706c652e737667)](https://yakhub.com.tr)

**YakNet Lighthouse** is a zero-dependency, ultra-lightweight, and premium performance profiler library for PHP applications. It enables developers to trace execution times and memory deltas of code blocks, build nested call trees, register checkpoints, and render gorgeous colorized profiles in the CLI or export them as premium dark-themed HTML dashboards.

---

🌟 Features
----------

[](#-features)

- ⏱️ **Call Tree Profiling**: Nest execution blocks to automatically trace time and memory hierarchy.
- ⚡ **Zero Dependencies**: Lightweight overhead written entirely in pure, highly-optimized PHP.
- 🩺 **Self-Healing Nested Stack**: Automatically handles and gracefully stops unclosed child spans when a parent is stopped.
- 📊 **Beautiful CLI Flame-Tree**: Renders colorized ASCII trees directly in the terminal, scaling units from microseconds to megabytes.
- 💎 **Premium HTML Dashboards**: Exports standalone, responsive, glassmorphic dark-themed reports with nested interactive trees, memory charts, and checkpoints.
- ⏳ **Checkpoint Deltas**: Track memory allocation changes relative to initialization benchmarks.

---

📦 Installation
--------------

[](#-installation)

Install the package via Composer:

```
composer require yaknet/lighthouse
```

---

🚀 Quick Start
-------------

[](#-quick-start)

### 1. Basic Usage

[](#1-basic-usage)

Wrap your code execution blocks with `start` and `stop` calls:

```
use YakNet\Lighthouse\Profiler;

// Start profiling the main flow with metadata tags
Profiler::start('Main Operation', ['controller' => 'UserController']);

// Start a sub-span (automatically becomes a child of 'Main Operation')
Profiler::start('DB Query', ['sql' => 'SELECT * FROM users']);
usleep(25000); // 25ms delay
Profiler::stop('DB Query');

// Stop the parent operation
Profiler::stop('Main Operation');
```

### 2. Measuring Callbacks

[](#2-measuring-callbacks)

Quickly measure the execution of closures using `measure`:

```
$result = Profiler::measure('API Call', function () {
    return file_get_contents('https://api.example.com/data');
}, ['endpoint' => 'get_data']);
```

### 3. Registering Checkpoints

[](#3-registering-checkpoints)

Trace specific code milestones and memory delta changes:

```
Profiler::checkpoint('Application Started');
// ... run code ...
Profiler::checkpoint('Cache Loaded');
```

---

📈 Generating Reports
--------------------

[](#-generating-reports)

### 1. Colorized CLI Flame-Tree

[](#1-colorized-cli-flame-tree)

Print a beautiful call tree directly to your terminal or logs:

```
use YakNet\Lighthouse\Renderer\CliRenderer;

$totalDuration = Profiler::getInstance()->getTotalDuration();
echo CliRenderer::render(Profiler::getRootSpans(), $totalDuration);
```

**Terminal Output Example:**

```
==================================================
 🕯️  YAKNET LIGHTHOUSE - PROFILE REPORT
==================================================
Total Wall Time: 190.3ms | Peak Memory: 2 MB

 └── [100.0%] Main Request (190.3ms, 2.4 KB) {route=/api/users, method=GET}
      ├── [ 24.8%] Database Query (47.2ms, 216 B) {sql=SELECT * FROM users WHERE status = ?}
      ├── [ 41.7%] External API Fetch (79.4ms, 408 B) {url=https://api.github.com/users}
      │    └── [  8.2%] JSON Decode (15.5ms, 216 B) {size=2.4MB}
      └── [ 16.2%] Template Rendering (30.8ms, 0 B) {template=dashboard.html}
==================================================

```

### 2. Standalone HTML Dashboard

[](#2-standalone-html-dashboard)

Generate a stunning dark-themed HTML report:

```
use YakNet\Lighthouse\Renderer\HtmlRenderer;

$htmlReport = HtmlRenderer::render(
    Profiler::getRootSpans(),
    Profiler::getCheckpoints(),
    Profiler::getInstance()->getTotalDuration(),
    Profiler::getInstance()->getPeakMemory(),
    Profiler::getInstance()->getInitMemory(),
    Profiler::getInstance()->getInitTime()
);

file_put_contents('lighthouse_report.html', $htmlReport);
```

---

🧪 Running Tests
---------------

[](#-running-tests)

Ensure all features work in your local environment by running the test suite:

```
composer test
```

Perform static analysis check at level 9:

```
composer analyze
```

---

📜 License
---------

[](#-license)

This project is licensed under the MIT License. See [LICENSE](LICENSE) for details. "Illuminate your code bottlenecks." 🕯️

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance94

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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

2

Last Release

46d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

profilerperformancetracebenchmarkdiagnosticsresilienceyaknetflamegraph

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/yaknet-lighthouse/health.svg)

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

###  Alternatives

[noisebynorthwest/php-spx

A simple &amp; straight-to-the-point PHP profiling extension with its built-in web UI

2.6k2.6k](/packages/noisebynorthwest-php-spx)[phpbenchmark/phpbenchmark

Easy to use benchmark toolkit for your PHP-application. This library contains classes for comparing algorithms as well as benchmarking application responses

8111.5k2](/packages/phpbenchmark-phpbenchmark)[wikimedia/arc-lamp

Flame graphs and log processing for PHP stack traces.

444.7k](/packages/wikimedia-arc-lamp)[sandstorm/plumber

Profiling Toolkit for Neos Flow and Neos

394.9k](/packages/sandstorm-plumber)[jsanc623/phpbenchtime

A lightweight benchmark timer and lap profiler for PHP.

2439.5k1](/packages/jsanc623-phpbenchtime)

PHPackages © 2026

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