pod-point/my-utility-genius-php

This package is abandoned and no longer maintained. No replacement package was suggested.

A PHP library for communicating with the My Utility Genius API

dev-master 2019-02-15 16:47 UTC

This package is auto-updated.

Last update: 2023-03-16 02:15:07 UTC


README

Build Status Packagist

A PHP library for communicating with the My Utility Genius API

Documentation

Installation

Require the package in composer:

"require": {
    "pod-point/my-utility-genius-php": "^1.0"
},

Laravel

If you are using a recent version of Laravel the service provider will automatically be registered. If not update your config/app.php providers array:

'providers' => [
    PodPoint\MyUtilityGenius\Providers\ServiceProvider::class
]

Then publish the config file:

php artisan vendor:publish --provider="PodPoint\MyUtilityGenius\Providers\ServiceProvider"

Finally, remember to set MUG_CLIENT_ID and MUG_CLIENT_SECRET in your env file.

Manually

You can also manually create a Client by passing in a Config object and optionally setting a token persistence class:

$config = new Config('client-id', 'client-secret');
$config->setTokenPersistence(new FileTokenPersistence('test.db'));
$client = new Client($config);

Usage

You can then use the client to make authenticated requests to the API:

$response = $client->json($client->get('request/Address/Postcode/Ready', [
    'query' => ['Postcode' => 'EC1 7YH']
]));