PHP code example of scn / evalanche-reporting-api-connector

1. Go to this page and download the library: Download scn/evalanche-reporting-api-connector 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/ */

    

scn / evalanche-reporting-api-connector example snippets


use Scn\EvalancheReportingApiConnector\Enum\Language;
use Scn\EvalancheReportingApiConnector\Enum\TimeFormat;
use Scn\EvalancheReportingApiConnector\EvalancheConfig;
use Scn\EvalancheReportingApiConnector\EvalancheConnection;

$connection = EvalancheConnection::create(
    new EvalancheConfig(
        'your evalanche hostname (no uri, just the hostname)',
        'username',
        'password',
        Language::LANG_EN,
        TimeFormat::ISO8601,
    ),
    // $requestFactory, (optional existing PSR-17 RequestFactory instance)
    // $httpClient, (optional existing PSR-18 Http-Client instance)
);

$connection->getPools()->asXml();

$connection->getPools()->asJsonArray();

$connection->getPools()->asJsonObject();

$connection->getPools()->asXml();

$connection->getPools()->asCsv();

$connection->getLeadpages(1234)->asJsonArray();

$connection->getProfiles(123)->asJsonArray();

$connection
    ->getMailings()
    ->withTimeRestriction('yesterday')
    ->asJsonArray();

$connection
    ->getMailings()
    ->withTimeRestriction('2018-09-27', 'yesterday')
    ->asJsonArray();

$connection
    ->getMailings()
    ->withTimeRestriction(null, 'yesterday')
    ->asJsonArray();

use Scn\EvalancheReportingApiConnector\Enum\Language;
use Scn\EvalancheReportingApiConnector\EvalancheConnection;

$connection = EvalancheConnection::create(
    'given host',
    'given username',
    'given password',
    Language::LANG_DE
);

use Scn\EvalancheReportingApiConnector\EvalancheConnection;
use Scn\EvalancheReportingApiConnector\Enum\Language;
use Scn\EvalancheReportingApiConnector\Enum\TimeFormat;

$connection = EvalancheConnection::create(
    'given host',
    'given username',
    'given password',
    Language::LANG_DE,
    TimeFormat::UNIX,
);