Scout supports Laravel 5.5+.
1. Install the
composer require scoutapp/scout-apm-laravel
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
file_get_contents. For more information, or to compile manually, the README has additional instructions.
3. Configure Scout in your
# Scout settings SCOUT_MONITOR=true SCOUT_KEY="[AVAILABLE IN THE SCOUT UI]" SCOUT_NAME="A FRIENDLY NAME FOR YOUR APP"
If you’ve installed Scout via the Heroku Addon, the provisioning process automatically sets
SCOUT_KEY via config vars. Only
SCOUT_NAME is required.
4. Clear your config cache:
php artisan config:clear
It takes approximatively five minutes for your data to first appear within the Scout UI.
Code Based Configuration
If for any reason you can’t use environment based configuration, or it’d simply be easier to manage Scout in code, you can configure Scout with a Laravel config file. First create the skeleton configuration file at
php artisan vendor:publish --provider="Scoutapm\Laravel\Providers\ScoutApmServiceProvider"
Then add any keys you want to override to the bottom of the file, following the template. The keys should be in lower case, with no prefixed
SCOUT_. Any keys not mentioned will continue to be read from the environment.
$config['name'] = 'Overriden Name';
Finally, deploy and remember update any cached configs.
Scout automatically inserts its middleware into your application on Laravel startup. It adds one at the very start of the middleware stack, and one at the end, allowing it to profile your middleware and controllers.