PHPackages                             markmorgan/octopus-energy - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. markmorgan/octopus-energy

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

markmorgan/octopus-energy
=========================

Octopus Energy PHP SDK

0.9.0(4y ago)06mitPHPPHP &gt;=7.1

Since Feb 8Pushed 4y ago1 watchersCompare

[ Source](https://github.com/mark-morgan/octopus-energy)[ Packagist](https://packagist.org/packages/markmorgan/octopus-energy)[ Docs](https://github.com/mark-morgan/octopus-energy)[ RSS](/packages/markmorgan-octopus-energy/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Octopus Energy PHP SDK
======================

[](#octopus-energy-php-sdk)

These PHP bindings provide convenient access to the Octopus Energy Restful API for PHP applications.

`Note: Accounts and Quotes endpoints are not implemented in this SDK as they are only available to Partner Organisations.`

Requirements
------------

[](#requirements)

- An Octopus Energy account API Key ()
- PHP &gt;= 7.1

Installation
------------

[](#installation)

Install using composer

```
composer require markmorgan/octopus-energy
```

Usage
-----

[](#usage)

### Initialisation

[](#initialisation)

Before requesting data you will need to set your access credentials. This is done by initialising the OctopusEnergy Client:

```
$apiKey = 'my-octopus-apikey';

$client = new \OctopusEnergy\Client($apiKey);
```

### Services

[](#services)

The SDK has services for `Product`, `Meter`, and `Industry` functions. The best place to look for all the functions available is within the services themselves.

#### Product

[](#product)

Fetch all products (additional product filters available, see function signature):

```
$productsSearch = $client->products->all();
```

Fetch a specific product from its product code:

```
$productCode = 'VAR-21-09-29';
$product = $client->products->get($productCode);
```

#### Meter

[](#meter)

Fetch info for a specific meter:

```
$mpan = 'YOUR MPAN NUMBER';
$meter = $client->meters->getElectricityMeter($mpan);
```

Fetch meter consumption:

```
$mpan = 'YOUR MPAN NUMBER';
$serialNumber = 'YOUR METER SERIAL NUMBER';

$consumptionSearch = $client->meters->getElectricityMeterConsumption(
    $mpan,
    $serialNumber
);
```

Filter the consumption between specific dates:

```
$fromDate = new \DateTime();
$fromDate->setTimestamp(1640995201);    // Jan 1st 2022

$toDate = new \DateTime();
$toDate->setTimestamp(1643673601);      // Feb 1st 2022

$pageNumber = 1;
$consumptionSearch = $client->meters->getElectricityMeterConsumption(
    $mpan,
    $serialNumber,
    $pageNumber,
    $fromDate,
    $toDate
);
```

#### Industry

[](#industry)

Fetch information about Grid Supply Points:

```
// fetch all grid supply point info
$gspSearch = $client->industry->getGridSupplyPoints();

// fetch grid supply point info for a postcode
$postcode = 'cf104uw';
$gspSearch = $client->industry->getGridSupplyPoints($postcode);
```

Testing
-------

[](#testing)

You can run PHPUnit against the library by running composer install and then running phpunit. Before doing so, you'll need to copy the example.phpunit.xml to phpunit.xml and change the environment variables for your API and meter details.

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 95.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1551d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5de4b9a90eadf6b595e1b5efc802683f2358da5661c616820b90c922f8aa8e05?d=identicon)[rogerthomas84](/maintainers/rogerthomas84)

![](https://www.gravatar.com/avatar/c566343bfe6b0a3602622dd1def882992f10ff114b6a95ffb000da2ba9e22578?d=identicon)[mark-morgan](/maintainers/mark-morgan)

---

Top Contributors

[![mark-morgan](https://avatars.githubusercontent.com/u/1934581?v=4)](https://github.com/mark-morgan "mark-morgan (44 commits)")[![rogerthomas84](https://avatars.githubusercontent.com/u/350232?v=4)](https://github.com/rogerthomas84 "rogerthomas84 (2 commits)")

---

Tags

phpoctopus energy

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/markmorgan-octopus-energy/health.svg)

```
[![Health](https://phpackages.com/badges/markmorgan-octopus-energy/health.svg)](https://phpackages.com/packages/markmorgan-octopus-energy)
```

###  Alternatives

[stevebauman/location

Retrieve a user's location by their IP Address

1.3k7.6M65](/packages/stevebauman-location)[gehrisandro/tailwind-merge-laravel

TailwindMerge for Laravel merges multiple Tailwind CSS classes by automatically resolving conflicts between them

341682.2k18](/packages/gehrisandro-tailwind-merge-laravel)[amirbagh75/smsir-php

Unofficial sms.ir PHP Package

181.2k](/packages/amirbagh75-smsir-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
