PHPackages                             linkorb/spark - 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. linkorb/spark

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

linkorb/spark
=============

Spark: application instrumentation

v1.5.0(5y ago)1180MITPHPPHP &gt;=7.2.0

Since Jul 2Pushed 5y ago1 watchersCompare

[ Source](https://github.com/linkorb/spark)[ Packagist](https://packagist.org/packages/linkorb/spark)[ Docs](http://www.github.com/linkorb/spark)[ RSS](/packages/linkorb-spark/feed)WikiDiscussions master Synced 1w ago

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

SPARK
=====

[](#spark)

Spark is an application instrumentation &amp; configuration library.

It is used to extract relevant information from the application for external processing.

For every Request + Response (Transaction), a set of Collectors are registered that capture detailed reports about every transaction.

Using one of the available Reporters, you can forward the extracted data to an external service for further processing.

Use-cases
---------

[](#use-cases)

- Integrare Spark into your application, and handle logging, performance monitoring, metrics, event processing, exception tracking, etc outside of your application
- Report application events to an event bus for further processing
- Forward exceptions and logs to a central service that can analyze, store or forward them using any custom backends.
- Analyze app transactions to collect metrics

By integrating Spark into your application, you no longer need to individually add instrumentation and other generic application services to each application.

Collectors
----------

[](#collectors)

### Existing collectors:

[](#existing-collectors)

- HTTP: Captures full HTTP Request and Response details, including query and post arguments, headers, attributes and server variables (environment)
- EventDispatcher: Captures all events that are dispatched during the transaction with name, payload and timestamp
- DoctrineSQLLogger: Captures all queries performed through a DBAL connection
- Logger: Captures all PSR-3 log messages
- Exception: Captures all exceptions with stack traces

### Future collectors:

[](#future-collectors)

- Guzzle: Capture all HTTP Requests performed by the application
- PDO: Raw PDO query collector
- Cache: Capture Cache hits and misses
- Stopwatch: Capture detailed time spans

Reporters
---------

[](#reporters)

At the end of the transaction, the collected information can be reported to one of serveral backends.

### Existing reporters:

[](#existing-reporters)

- EchoReporter: Echos the data as pretty printed JSON in a code tag at the end of the page
- NdJsonReporter: Writes the data as NDJSON lines to a file
- GuzzleReporter: Submit the data as JSON using an HTTP POST

### Future reporters:

[](#future-reporters)

- NATS
- Kafka
- Local spool (for batch optimisation)

Usage
-----

[](#usage)

Install Spark in your project:

```
composer require linkorb/spark

```

### Symfony 4 / 5

[](#symfony-4--5)

In `services.yaml` register Spark with the following configuration lines:

```
services:
    # Register a Spark instance
    Spark\Spark:
        public: true
        factory: ['Spark\Spark', 'getInstance']

    # Decorate the Symfony EventDispatcher to capture event data
    # Be sure to select the dispatcher that matches your version of the event dispatcher
    Spark\EventDispatcher\SparkEventDispatcherV5:
        decorates: 'event_dispatcher'

    # Capture PSR-3 Log data
    Spark\Logger\SparkLogger:
        decorates: 'logger'

    # Capture Doctrine DBAL data
    Spark\Doctrine\SparkDoctrineEventSubscriber:
        tags:
            - { name: doctrine.event_subscriber, connection: default }
    Spark\Doctrine\SparkSQLLogger:
        public: true

    # Register Event Subscriber to automatically report data on
    # kernel.terminate and capture kernel.exception data
    Spark\EventSubscriber\SparkEventSubscriber:
        public: true

```

Since Symfony's EventDispatcher method signatures have change throughout versions, multiple decorators for V3, V4 and V5 are available.

Please refer to src/EventDispatcher/README.md for details

### Other frameworks / libraries

[](#other-frameworks--libraries)

1. Instantiate a spark instance using `$spark = \Spark\Spark::getInstance()`
2. Register collectors by decorating EventDispatcher, Logger, etc
3. After the transaction completes, call $spark-&gt;report();

### Whitelisting reported keys

[](#whitelisting-reported-keys)

By default, Spark reports all the keys in the collected data for each transaction. You can apply a whitelist filter to limit the reported data by specifying `SPARK_REPORT_WHITELIST` with an array of patterns. For example:

```
SPARK_REPORT_WHITELIST=id,type,http.response.*,queries.*

```

License
-------

[](#license)

MIT. Please refer to the [license file](LICENSE) for details.

Brought to you by the LinkORB Engineering team
----------------------------------------------

[](#brought-to-you-by-the-linkorb-engineering-team)

[![](https://camo.githubusercontent.com/62fb66b034de7ea7fca9fd9776424b5348daa76ef8622caf92c2f7622003e5ef/687474703a2f2f7777772e6c696e6b6f72622e636f6d2f642f6d6574612f74696572312f696d616765732f6c696e6b6f7262656e67696e656572696e672d6c6f676f2e706e67)](https://camo.githubusercontent.com/62fb66b034de7ea7fca9fd9776424b5348daa76ef8622caf92c2f7622003e5ef/687474703a2f2f7777772e6c696e6b6f72622e636f6d2f642f6d6574612f74696572312f696d616765732f6c696e6b6f7262656e67696e656572696e672d6c6f676f2e706e67)
Check out our other projects at [linkorb.com/engineering](http://www.linkorb.com/engineering).

Btw, we're hiring!

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Total

9

Last Release

2103d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1db66b320db18b8036ea68211b7d8a39e7c6da97e6fd29f59a50380ebb69d0bb?d=identicon)[joostfaassen](/maintainers/joostfaassen)

---

Top Contributors

[![joostfaassen](https://avatars.githubusercontent.com/u/411113?v=4)](https://github.com/joostfaassen "joostfaassen (13 commits)")

---

Tags

eventsapmevent-emitterlinkorbsparkexception trackingremote configuration

### Embed Badge

![Health badge](/badges/linkorb-spark/health.svg)

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

###  Alternatives

[justbetter/magento2-sentry

Magento 2 Logger for Sentry

1851.5M3](/packages/justbetter-magento2-sentry)[leventcz/laravel-top

Real-time monitoring straight from the command line for Laravel applications.

581105.7k1](/packages/leventcz-laravel-top)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2222.9M248](/packages/open-telemetry-sdk)[open-telemetry/api

API for OpenTelemetry PHP.

1833.0M214](/packages/open-telemetry-api)[pkerrigan/xray

A basic PHP instrumentation library for AWS X-Ray

601.4M3](/packages/pkerrigan-xray)[arkaitzgarro/elastic-apm-laravel

Laravel APM agent for Elastic v2 intake API

84433.6k](/packages/arkaitzgarro-elastic-apm-laravel)

PHPackages © 2026

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