PHPackages                             scoutapp/scout-apm-php - 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. scoutapp/scout-apm-php

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

scoutapp/scout-apm-php
======================

Scout Application Performance Monitoring Agent - https://scoutapm.com

8.12.0(2y ago)17888.4k↓72.9%3[26 issues](https://github.com/scoutapp/scout-apm-php/issues)5MITPHPPHP 7.2.\*|7.3.\*|7.4.\*|8.0.\*|8.1.\*|8.2.\*|8.3.\*CI failing

Since Aug 6Pushed 2y ago2 watchersCompare

[ Source](https://github.com/scoutapp/scout-apm-php)[ Packagist](https://packagist.org/packages/scoutapp/scout-apm-php)[ Docs](https://scoutapm.com/)[ RSS](/packages/scoutapp-scout-apm-php/feed)WikiDiscussions 8.13.x Synced 2d ago

READMEChangelog (10)Dependencies (30)Versions (74)Used By (5)

Scout PHP APM Agent
===================

[](#scout-php-apm-agent)

[![Build](https://github.com/scoutapp/scout-apm-php/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/scoutapp/scout-apm-php/actions/workflows/continuous-integration.yml) [![Latest Stable Version](https://camo.githubusercontent.com/fe2721ba8862d0bb532f205627f82afe1db6baec241b7a8511a13381554d9543/68747470733a2f2f706f7365722e707567782e6f72672f73636f75746170702f73636f75742d61706d2d7068702f762f737461626c65)](https://packagist.org/packages/scoutapp/scout-apm-php) [![Total Downloads](https://camo.githubusercontent.com/f11756fb2e074550086948882b194595d59f43059332a9c3cee2a68b67b1d365/68747470733a2f2f706f7365722e707567782e6f72672f73636f75746170702f73636f75742d61706d2d7068702f646f776e6c6f616473)](https://packagist.org/packages/scoutapp/scout-apm-php) [![License](https://camo.githubusercontent.com/08c699fa875deeb99e6e431397d39fcf8627f6e464a5e5d56b42bda7975bfc62/68747470733a2f2f706f7365722e707567782e6f72672f73636f75746170702f73636f75742d61706d2d7068702f6c6963656e7365)](https://packagist.org/packages/scoutapp/scout-apm-php)

Email us at  to get on the beta invite list!

Monitor the performance of PHP apps with Scout's [PHP APM Agent](https://www.scoutapm.com).

Detailed performance metrics and transaction traces are collected once the agent is installed and configured.

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

[](#requirements)

PHP Versions: 7.2+

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

[](#quick-start)

This package is the base library for the various framework-specific packages.

### Laravel, Lumen, Symfony support

[](#laravel-lumen-symfony-support)

To install the ScoutAPM Agent for a specific framework, use the specific package instead.

- [Laravel](https://github.com/scoutapp/scout-apm-laravel)
- [Lumen](https://github.com/scoutapp/scout-apm-lumen)
- [Symfony](https://github.com/scoutapp/scout-apm-symfony-bundle/)

### Using the base library directly

[](#using-the-base-library-directly)

```
use Psr\Log\LoggerInterface;
use Scoutapm\Agent;
use Scoutapm\Config;
use Scoutapm\Config\ConfigKey;

// It is assumed you are using a PSR Logger
/** @var LoggerInterface $psrLoggerImplementation */

$agent = Agent::fromConfig(
    Config::fromArray([
        ConfigKey::APPLICATION_NAME => 'Your application name',
        ConfigKey::APPLICATION_KEY => 'your scout key',
        ConfigKey::MONITORING_ENABLED => true,
    ]),
    $psrLoggerImplementation
);
// If the core agent is not already running, this will download and run it (from /tmp by default)
$agent->connect();

// Use $agent to record `webTransaction`, `backgroundTransaction`, `instrument` or `tagRequest` as necessary

// Nothing is sent to Scout until you call this - so call this at the end of your request
$agent->send();
```

#### Default log level

[](#default-log-level)

By default, the library is *very* noisy in logging by design - this is to help us figure out what is going wrong if you need assistance. If you are confident everything is working, and you can see data in your Scout dashboard, then you can increase the minimum log level by adding the following configuration to set the "minimum" log level (which **only**applies to Scout's logging):

```
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
use Scoutapm\Agent;
use Scoutapm\Config;
use Scoutapm\Config\ConfigKey;

/** @var LoggerInterface $psrLoggerImplementation */

$agent = Agent::fromConfig(
    Config::fromArray([
        ConfigKey::APPLICATION_NAME => 'Your application name',
        ConfigKey::APPLICATION_KEY => 'your scout key',
        ConfigKey::MONITORING_ENABLED => true,
        ConfigKey::LOG_LEVEL => LogLevel::ERROR, // exec` and so on.

Alternatively, you can [install from source](https://github.com/scoutapp/scout-apm-php-ext).

Enable caching for Scout
------------------------

[](#enable-caching-for-scout)

Due to PHP's stateless and "shared-nothing" architecture, the Scout library performs some checks (such as sending some metadata about the running system) on every request. These can be eliminated by giving Scout a PSR-16 (Simple Cache) implementation when creating the agent:

```
use Doctrine\Common\Cache\RedisCache;
use Psr\Log\LoggerInterface;
use Roave\DoctrineSimpleCache\SimpleCacheAdapter;
use Scoutapm\Agent;
use Scoutapm\Config;
use Scoutapm\Config\ConfigKey;

/** @var LoggerInterface $psrLoggerImplementation */
$yourPsrSimpleCacheImplementation = new SimpleCacheAdapter(new RedisCache());

$agent = Agent::fromConfig(
    Config::fromArray([
        ConfigKey::APPLICATION_NAME => 'Your application name',
        ConfigKey::APPLICATION_KEY => 'your scout key',
        ConfigKey::MONITORING_ENABLED => true,
    ]),
    $psrLoggerImplementation,
    $yourPsrSimpleCacheImplementation
);
```

Using the PSR-15 Middleware provided
------------------------------------

[](#using-the-psr-15-middleware-provided)

Since `scoutapp/scout-apm-php` release version 8.1.0, a PSR-15 compatible middleware is included out the box, which may be used in a PSR-15 middleware-compatible framework, such as Slim or Mezzio. For example, in Slim framework:

```
// Assumes $app is defined, e.g. an instance of `\Slim\App`
$app->add(\Scoutapm\Middleware\ScoutApmMiddleware::class);
```

You will very likely need to define `\Scoutapm\Middleware\ScoutApmMiddleware::class` in your container. For example, if your container is Laminas ServiceManager, you could define a factory like:

```
// Assumes $serviceManager is defined, e.g. an instance of `\Laminas\ServiceManager\ServiceManager`
$serviceManager->setFactory(
    \Scoutapm\Middleware\ScoutApmMiddleware::class,
    static function (\Psr\Container\ContainerInterface $container) {
        $logger = $container->get(LoggerInterface::class);

        $agent = Agent::fromConfig(
            Config::fromArray([
                // any additional array configuration
            ]),
            $logger
        );

        return new ScoutApmMiddleware($agent, $logger);
    }
);
```

Documentation
-------------

[](#documentation)

For full installation and troubleshooting documentation, visit our [help site](http://docs.scoutapm.com/#php-agent).

Support
-------

[](#support)

Please contact us at  or create an issue in this repo.

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity45

Moderate usage in the ecosystem

Community24

Small or concentrated contributor base

Maturity89

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 95.1% 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 ~24 days

Recently: every ~47 days

Total

74

Last Release

753d ago

Major Versions

v3.1.0 → v4.0.02020-01-08

v4.4.1 → v5.0.02020-09-10

v5.3.0 → v6.0.0-alpha12021-02-22

v6.7.0 → v7.0.02022-01-18

v7.0.0 → v8.0.02022-03-08

PHP version history (7 changes)v0.1.0PHP &gt;= 7.1

v0.1.1PHP &gt;=7.1.0,&lt;7.5.0

v6.0.0-alpha1PHP 7.1.\*|7.2.\*|7.3.\*|7.4.\*|8.0.\*

v7.0.0PHP 7.1.\*|7.2.\*|7.3.\*|7.4.\*|8.0.\*|8.1.\*

8.3.0PHP 7.2.\*|7.3.\*|7.4.\*|8.0.\*|8.1.\*

8.8.0PHP 7.2.\*|7.3.\*|7.4.\*|8.0.\*|8.1.\*|8.2.\*

8.11.x-devPHP 7.2.\*|7.3.\*|7.4.\*|8.0.\*|8.1.\*|8.2.\*|8.3.\*

### Community

Maintainers

![](https://www.gravatar.com/avatar/2734194006e4987a8e12379a63b4f6c0a4478b5818ea7ce677499b1f714a92d2?d=identicon)[asgrim](/maintainers/asgrim)

![](https://avatars.githubusercontent.com/u/49919454?v=4)[Scout APM](/maintainers/ScoutAPM)[@scoutapm](https://github.com/scoutapm)

---

Top Contributors

[![asgrim](https://avatars.githubusercontent.com/u/496145?v=4)](https://github.com/asgrim "asgrim (765 commits)")[![lancepioch](https://avatars.githubusercontent.com/u/1296882?v=4)](https://github.com/lancepioch "lancepioch (22 commits)")[![arcdigital](https://avatars.githubusercontent.com/u/551002?v=4)](https://github.com/arcdigital "arcdigital (11 commits)")[![cschneid](https://avatars.githubusercontent.com/u/6119?v=4)](https://github.com/cschneid "cschneid (2 commits)")[![naohiro-t](https://avatars.githubusercontent.com/u/31594089?v=4)](https://github.com/naohiro-t "naohiro-t (2 commits)")[![pjohnmeyer](https://avatars.githubusercontent.com/u/122016?v=4)](https://github.com/pjohnmeyer "pjohnmeyer (1 commits)")[![adamchainz](https://avatars.githubusercontent.com/u/857609?v=4)](https://github.com/adamchainz "adamchainz (1 commits)")

---

Tags

monitoringperformanceapmdevelopment

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/scoutapp-scout-apm-php/health.svg)

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

###  Alternatives

[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[cakephp/cakephp

The CakePHP framework

8.9k19.5M1.8k](/packages/cakephp-cakephp)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M736](/packages/sylius-sylius)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35789.4k2](/packages/telnyx-telnyx-php)

PHPackages © 2026

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