PHP code example of ph-ash / client-php

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

    

ph-ash / client-php example snippets


    $requestFactory = ...; // instanceof Psr\Http\Message\RequestFactoryInterface
    $uriFactory = ...; // instanceof Psr\Http\Message\UriFactoryInterface
    $streamFactory = ...; // instanceof Psr\Http\Message\StreamFactoryInterface
    $client = ...; // instanceof Psr\Http\Client\ClientInterface
    $client = new Phash\ClientPSR('http://localhost', 'someToken', $requestFactory, $uriFactory, $streamFactory, $client);

    $guzzleClient = new GuzzleHttp\Client(['base_uri' => 'http://localhost']);
    $client = new Phash\ClientGuzzle('someToken', $guzzleClient);

    $data = new Phash\MonitoringData(
        'monitoring id',
        Phash\MonitoringData::STATUS_OK,
        'this detail message will be displayed if a tile is clicked by a user',
        60,
        1,
        new \DateTimeImmutable(),
        'path.for.tree' // can be `null` for a flat display
    );

    // optional data
    $data->setTileExpansionIntervalCount(2);
    $data->setTileExpansionGrowthExpression('+ 4');

    $client->push($data);