PHP code example of lee / php-green-button
1. Go to this page and download the library: Download lee/php-green-button 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/ */
lee / php-green-button example snippets
use Carbon\Carbon;
use Lee\Green\Button\CustomerDataWriter;
$dateTimeString = Carbon::now(self::$timezone)->format('Y-m-d\TH:i:s\Z');
$options = [
'title' => 'Green Button Customer Feed',
'account_id' => 'Peter',
'meter_form_number' => 'TD17234599',
'end_device_serial_number' => '99123456',
];
$customerDataWriter = new CustomerDataWriter($options);
$customerDataWriter->setPublishedDateTime($dateTimeString);
$customerDataWriter->setUpdatedDateTime($dateTimeString);
$result = $customerDataWriter->createCustomerAccountData();
bash
composer