PHP code example of messagebird / pushprom-yii2-client

1. Go to this page and download the library: Download messagebird/pushprom-yii2-client 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/ */

    

messagebird / pushprom-yii2-client example snippets


'pushprom' => [
    'class' => \pushprom\yii2\Component::className(),
    'job' => 'messagebird',
    'url' => 'udp://127.0.0.1:9090'
],

$gauge = new \pushprom\Gauge(
    \Yii::$app->pushprom,
    "fish_in_the_sea",
    "The amount of fish in the sea",
    [
        "species" => "Thalassoma noronhanum"
    ]
);
$gauge->set(2000);

$config = [
    'components' => [
        'response' => [
            // ...
            'on beforeSend' => function ($event) {
                \Yii::$app->pushprom->logHttpResponse($event->sender->getStatusCode());
                \Yii::$app->pushprom->logResponseTimeMs();
            }
        ]
    ]
];