PHP code example of ecodenl / ep-online-php-wrapper

1. Go to this page and download the library: Download ecodenl/ep-online-php-wrapper 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/ */

    

ecodenl / ep-online-php-wrapper example snippets


use Ecodenl\EpOnlinePhpWrapper\Client;
use Ecodenl\EpOnlinePhpWrapper\EpOnline;

$secret = 'asecretcodeyouneedtoobtain';

// Establish the connection
$client = Client::init($secret);

// To get extensive logging from each request
// the client accepts any logger that follows the (PSR-3 standard)[https://github.com/php-fig/log]
// This example uses the logger from laravel, but feel free to pass any logger that implements the \Psr\Log\LoggerInterface
$logger = \Illuminate\Support\Facades\Log::getLogger();
$client = Client::init($secret, $logger);

$epOnline = EpOnline::init($client);

// Get the available energylabel from the given address (see
// the official api docs (https://public.ep-online.nl/swagger/index.html) for all possible parameters  
$label = $epOnline->pandEnergielabel()
  ->byAddress([
    'postcode' => '3255MC',
    'huisnummer' => 13,
  ]);

// Search on a ID from the bag ("adresseerbaarObjectId") 
$address = $epOnline->pandEnergielabel()
    ->byId('1924010000030064');

composer