lee/php-green-button

A Green Button Library for PHP

v0.1 2020-08-20 08:44 UTC

This package is auto-updated.

Last update: 2024-11-20 18:07:56 UTC


README

A Green Button Generator for PHP.

PHP

Requirements

  • PHP 7.2+

Installation

composer require lee/php-green-button

Usage

Using following codes to generate a customer agreement information XML:

<?php

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

Similar libraries

License

The MIT License (MIT). Please see License File for more information.