ecodenl/ep-online-php-wrapper

EP Online 公共 REST API 的 PHP 包装器

v3.0.0 2023-06-09 09:14 UTC

This package is auto-updated.

Last update: 2024-09-15 13:22:24 UTC


README

EP Online API 的简单 PHP 包装器。

版本信息

安装

composer require ecodenl/ep-online-php-wrapper

使用 API

阅读官方 API 文档

为了了解可能性和限制,你应该阅读 官方 API 文档

设置连接

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);

资源

PandEnergielabel

// 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');