PHPackages                             assetplan/scout-lite-apm - 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. assetplan/scout-lite-apm

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

assetplan/scout-lite-apm
========================

Small implementation around ScoutAPM Core Agent

1.7.3(10mo ago)05.1k↓31.8%MITPHPPHP &gt;=5.6

Since May 20Pushed 10mo ago2 watchersCompare

[ Source](https://github.com/AssetPlan/scout-lite-apm)[ Packagist](https://packagist.org/packages/assetplan/scout-lite-apm)[ RSS](/packages/assetplan-scout-lite-apm/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)DependenciesVersions (13)Used By (0)

ScoutLite APM
=============

[](#scoutlite-apm)

A lightweight, zero-dependency PHP tracing utility compatible with the [Scout APM Core Agent](https://docs.scoutapm.com/#scout-apm-core-agent). Designed for legacy PHP applications (CakePHP 1.3, Laravel 5.x, custom stacks) running PHP 5.6+.

No Composer bloat, no framework magic. Just trace your code and send to the agent.

---

✨ Features
----------

[](#-features)

- ✅ Works with PHP **5.6+**
- ✅ Compatible with **Scout APM Core Agent**
- ✅ Flush-safe in environments using `exit()` and `die()`
- ✅ Tracks controller actions, SQL queries, and custom code spans
- ✅ Automatically redacts SQL values
- ✅ Simple API for instrumentation
- ✅ Fully buffered and flushed in a single atomic write
- ✅ Measures request queue time (when available)

---

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

[](#-installation)

Via Composer:

```
composer require assetplan/scout-lite-apm
```

---

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

[](#-quick-start)

```
use AssetPlan\ScoutLiteAPM\TraceSession;

// Bootstrap (registers your app + configures socket path)
TraceSession::bootstrap('YourAppName', 'your-agent-key');

// Start the request
TraceSession::startRequest();

// Optionally measure queue time automatically

// Custom lifecycle span (e.g. beforeFilter in CakePHP)
$lifecycle = TraceSession::startCustom('Lifecycle/beforeFilter');
// ...
TraceSession::endCustom($lifecycle);

// Instrument a controller span
$controller = TraceSession::startController('UserController', 'index');
// ...
TraceSession::endController($controller);

// Instrument SQL (automatically redacted)
$sqlSpan = TraceSession::startSql('SELECT * FROM users WHERE id = 123');
// ...
TraceSession::endSql($sqlSpan);

// Finish the request
TraceSession::endRequest();

// Flush (optional — you can also register a shutdown handler)
TraceSession::flush();
```

---

🔐 Requirements
--------------

[](#-requirements)

- PHP 5.6 or greater
- [Scout APM Core Agent](https://docs.scoutapm.com/#scout-apm-core-agent) running and listening via UNIX or TCP socket

---

⚙️ Configuration
----------------

[](#️-configuration)

By default, the Core Agent is expected at `tcp://127.0.0.1:6590`. To override the socket path or API version:

```
TraceSession::bootstrap('YourApp', 'your-key', '/tmp/scout-agent.sock');
// or
TraceSession::register('YourApp', 'your-key', '/tmp/scout-agent.sock', '1.0');
```

---

💡 Tips
------

[](#-tips)

- Calling `flush()` multiple times is safe — only one send will occur.
- If any span is left open, or `FinishRequest` is missing, flush will be aborted.
- Custom instrumentation can be added using `startCustom()` / `endCustom()` or `instrument()`.
- Queue time will be included if headers like `X-Request-Start` are available.
- You can inspect internals via:

    - `TraceSession::getOpenSpans()`
    - `TraceSession::getEventBuffer()`
    - `TraceSession::getRequestId()`

---

🤝 License
---------

[](#-license)

MIT © AssetPlan

---

🧠 Authors
---------

[](#-authors)

Crafted by humans who deal with legacy PHP and still want great observability.

- Cristian Fuentes ([@cfuentessalgado](https://github.com/cfuentessalgado))

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance53

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 94.4% 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 ~4 days

Recently: every ~9 days

Total

11

Last Release

325d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/497d3dd414247d44d8943533c03e5e69613f037bb891fdf0ac3382166a7c7ae3?d=identicon)[cfuentessalgado](/maintainers/cfuentessalgado)

---

Top Contributors

[![cfuentessalgado](https://avatars.githubusercontent.com/u/8118712?v=4)](https://github.com/cfuentessalgado "cfuentessalgado (17 commits)")[![google-labs-jules[bot]](https://avatars.githubusercontent.com/in/842251?v=4)](https://github.com/google-labs-jules[bot] "google-labs-jules[bot] (1 commits)")

### Embed Badge

![Health badge](/badges/assetplan-scout-lite-apm/health.svg)

```
[![Health](https://phpackages.com/badges/assetplan-scout-lite-apm/health.svg)](https://phpackages.com/packages/assetplan-scout-lite-apm)
```

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41838.2M138](/packages/graylog2-gelf-php)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[consolidation/log

Improved Psr-3 / Psr\\Log logger based on Symfony Console components.

15462.2M7](/packages/consolidation-log)[ekino/newrelic-bundle

Integrate New Relic into Symfony2

28111.2M8](/packages/ekino-newrelic-bundle)

PHPackages © 2026

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