Skip to content

Polyfill for the Datadog dd-trace PHP extension

License

Notifications You must be signed in to change notification settings

Yoopies/dd-trace-polyfill-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Polyfill for the dd-trace PHP extension.

Total Downloads

Using Datadog Trace's PHP extension requires us to use this pattern everywhere:

if (extension_loaded('ddtrace')) {
    $rootSpan = \DDTrace\root_span();
    $rootSpan->meta['usr.id'] = '123456789';
}

This package is a polyfill re-declaring all the functions provided by Datadog when the extension is not installed. In other words, after installing this polyfill you can rely on the function to exist:

$span = \DDTrace\active_span();

If the extension is installed, everything will work as expected. If not (for example on your development machine) nothing will happen.

Installation

composer require yoopies/dd-trace-polyfill-php

That's all you need to do!

About

Polyfill for the Datadog dd-trace PHP extension

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages