PHP code example of taildev / php

1. Go to this page and download the library: Download taildev/php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

taildev / php example snippets




use Tail\Apm;

Apm::init('secret_token', 'service-name');
Apm::startRequest(); 

register_shutdown_function(function () {
    Apm::finish();
});

$span = Apm::newDatabaseSpan('fetch-config');
// ... code fetching config
$span->finish();

Apm::newSpan(string $type, string $name); // to use your own custom type
Apm::newCustomSpan($name); // type = "custom"
Apm::newDatabaseSpan($name); // type = "database"
Apm::newCacheSpan($name); // type = "cache"
Apm::newFilesystemSpan($name); // type = "filesystem"

use Tail\Log;

Log::init('secret_token', 'optional-service-name', 'optional-environment');

use Tail\Log;

Log::get()->debug('my debug message');

Log::get()->alert('something went wrong', ['custom_tag' => 'some-value']);