Symfony
Symfony
Scout supports Symfony 4+.
1. Install the scoutapp/scout-apm-symfony-bundle
bundle:
composer require scoutapp/scout-apm-symfony-bundle
Note that the scout-apm-php
package will automatically be included. It does not need to be installed directly.
2. Install the scoutapm
php extension (optional, recommended):
sudo pecl install scoutapm
Several instruments require the native extension to be included, including timing of libcurl
and file_get_contents
. For more information, or to compile manually, the README has additional instructions.
3. Configure Scout in your config/packages/scoutapm.xml
file:
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:scoutapm="http://example.org/schema/dic/scout_apm"
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd">
<scoutapm:config>
<scoutapm:scoutapm
name="my application name..."
key="%env(SCOUT_KEY)%"
monitor="true"
/>
</scoutapm:config>
</container>
It is recommended not to commit the Scout APM key to version control. Instead, configure via environment variables, e.g. in .env.local
:
SCOUT_KEY=your_scout_key_here
Since the configuration XML above uses %env(SCOUT_KEY)%
this will be pulled in automatically.
4. Add the bundle to config/bundles.php
.
<?php
return [
// ... other bundles...
Scoutapm\ScoutApmBundle\ScoutApmBundle::class => ['all' => true],
];
5. Deploy.
It takes approximatively five minutes for your data to first appear within the Scout UI.