PHP code example of cyberclick-os / apm-symfony-messenger

1. Go to this page and download the library: Download cyberclick-os/apm-symfony-messenger 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/ */

    

cyberclick-os / apm-symfony-messenger example snippets



declare(strict_types=1);

class TextNameExtractor implements PcComponentes\ElasticAPM\Symfony\Component\Messenger\NameExtractor
{
    public function execute($message): string
    {
        if (false === is_string($message)) {
            throw new InvalidArgumentException('The parameter must be of type string');
        }

        return $message;
    }
}

$apmMiddleware = new PcComponentes\ElasticAPM\Symfony\Component\Messenger\ApmMiddleware(
    $apmTracer, /** \ZoiloMora\ElasticAPM\ElasticApmTracer instance. */
    new TextNameExtractor(),
);

$bus = new Symfony\Component\Messenger\MessageBus([
    $apmMiddleware
]);