Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Elastic Apm Php Agent Laravel Package

nipwaayoni/elastic-apm-php-agent

Laravel-friendly Elastic APM PHP agent for instrumenting apps and sending performance data, errors, and transactions to an Elastic APM Server. Helps monitor response times, slow queries, and exceptions with simple setup and configurable reporting.

View on GitHub
Deep Wiki
Context7

Initialize the Agent

Note: While it is still possible to directly create an Agent object, this example uses the preferred AgentBuilder class.

The AgentBuilder is used to set all Agent options and make the final Agent object.

// Minimal required usage
$agent = (new \Nipwaayoni\AgentBuilder())->withConfig(new Config(['serviceName' => 'My Application']))->build();

// Setting more options
$builder = new \Nipwaayoni\AgentBuilder();
$builder->withConfig(new Nipwaayoni\Config(['serviceName' => 'My Application']));
$builder->withUserContextData([
        'id'    => 12345,
        'email' => 'email@acme.com',
    ]);
$builder->withCustomContextData([
        // ... more key-values
    ]);
$builder->withLabelData([
        // ... more key-values
    ]);
$agent = $builder->build();

All with methods of the support fluent chaining, so the previous example could be written as:

$agent = (new \Nipwaayoni\AgentBuilder())
    ->withConfig(new Nipwaayoni\Config(['serviceName' => 'My Application']))
    ->withUserContextData([
        'id'    => 12345,
        'email' => 'email@acme.com',
    ])
    ->withCustomContextData([
        // ... more key-values
    ])
    ->withLabelData([
        // ... more key-values
    ])
    ->build();

This makes conditionally setting options easy:

$builder = (new \Nipwaayoni\AgentBuilder())
    ->withConfig(new Nipwaayoni\Config(['serviceName' => 'My Application']));

if ($app->hasUser()) {
    $builder->withUserContextData([
        'id'    => $app->getUserId(),
        'email' => $app->getUserEmail(),
    ]);
}

$agent = $builder->build();

You can also provide a customized HTTP client, for example, to disable certificate validation:

$agent = (new \Nipwaayoni\AgentBuilder())
    ->withConfig(new Nipwaayoni\Config(['serviceName' => 'My Application']))
    ->withHttpClient(new \Http\Adapter\Guzzle6\Client(new \GuzzleHttp\Client(['verify' => false])))
    ->build();
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui