PHP code example of paulogic / esios

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

    

paulogic / esios example snippets


#!php

    $token = 'AUTHENTICATION TOKEN';
    
    //Prepare the factory
    $factory = new Esios\EsiosHelperFactory($token);

    //Create a helper to issue calls to obtain the list of prices
    $helper = $factory->getEsiosCaller(Esios\EsiosCallTypes::PVPC_20A_PRICES);
    $params = [
         'start_date' => '2017-04-01T01:00',
         'end_date' => '2017-04-01T05:00'
    ];
    $data = $helper->get($params);

    //Create a helper to issue calls to obtain the list of indicators
    $helper = $factory->getEsiosCaller(Esios\EsiosCallTypes::INDICATORS_LIST);
    $params = [
        'text' => 'facturacion de energia'
    ];
    $data = $helper->get($params);

#!php

    $token = 'AUTHENTICATION TOKEN';
    //optional config, may be empty
    $config = [
        'timeout' => 10,
        'timezone' => 'Atlantic/Canary'    
    ];
    $callService = new Esios\Service\EsiosCallService($token, $config);

    $params = [
        'start_date' => '2017-04-23',
        'end_date' => '2017-04-24',
    ];

    //Direct call to indicator 1013 (prices of rate 20A)
    $data = $callService->getData('/indicators/1013', $params);