PHPackages                             nieknijland/ista-php - 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. [API Development](/categories/api)
4. /
5. nieknijland/ista-php

ActiveLibrary[API Development](/categories/api)

nieknijland/ista-php
====================

PHP client for the Ista energy consumption API

v0.1.0(3mo ago)00[1 PRs](https://github.com/NiekNijland/ista-php/pulls)MITPHPPHP ^8.4CI failing

Since Mar 14Pushed 2mo agoCompare

[ Source](https://github.com/NiekNijland/ista-php)[ Packagist](https://packagist.org/packages/nieknijland/ista-php)[ Docs](https://github.com/nieknijland/ista-php)[ GitHub Sponsors](https://github.com/NiekNijland)[ RSS](/packages/nieknijland-ista-php/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (1)Dependencies (6)Versions (4)Used By (0)

Ista PHP
========

[](#ista-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/dcf8d449746d9e2438569c145a58eb3d680120409aa22f11307a429ee6ae7025/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e69656b6e696a6c616e642f697374612d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nieknijland/ista-php)[![Tests](https://camo.githubusercontent.com/4cc79abf2552c58872158c81cd82850020c5b93231da0c06d745ba2f17bda8be/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6e69656b6e696a6c616e642f697374612d7068702f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/nieknijland/ista-php/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/a4a233f8d029ac0462d83b593ede5ae83a522d4f56d84b86291900ea1b515526/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e69656b6e696a6c616e642f697374612d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nieknijland/ista-php)

PHP client for the Ista energy consumption API at `mijn.ista.nl`. Framework-agnostic.

Requires PHP 8.4+.

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

[](#installation)

```
composer require nieknijland/ista-php
```

Quick start
-----------

[](#quick-start)

```
use NiekNijland\Ista\Ista;

$ista = new Ista(
    username: 'your@email.com',
    password: 'your-password',
);

// Fetch all consumption data
$userValues = $ista->getUserValues();

$customer = $userValues->customers[0];

foreach ($customer->consumption->services as $service) {
    echo "Current usage: {$service->totalNow}\n";
    echo "Previous year: {$service->totalPrevious}\n";

    foreach ($service->currentMeters as $meter) {
        echo "  {$meter->position}: {$meter->value}\n";
    }
}
```

Constructor
-----------

[](#constructor)

```
$ista = new Ista(
    username: 'your@email.com',
    password: 'your-password',
    httpClient: $customGuzzleClient,  // ?ClientInterface, default: new Client()
    cache: $psr16Cache,               // ?CacheInterface (PSR-16), default: null (no caching)
    cacheTtl: 3600,                   // int, cache TTL in seconds, default: 3600
);
```

ParameterTypeDefaultDescription`$username``string`*(required)*Your mijn.ista.nl username`$password``string`*(required)*Your mijn.ista.nl password (marked `#[SensitiveParameter]`)`$httpClient``?ClientInterface``null`Custom Guzzle HTTP client; `null` creates a default one`$cache``?CacheInterface``null`Any PSR-16 cache implementation; `null` disables caching`$cacheTtl``int``3600`Cache time-to-live in secondsAPI methods
-----------

[](#api-methods)

The client provides four methods. All throw `IstaException` on failure.

MethodDescription[`getUserValues()`](docs/api-methods.md#getuservalues)Fetch all customers, meters, and billing data[`getConsumptionAverages()`](docs/api-methods.md#getconsumptionaverages)Fetch building average consumption[`getMonthlyConsumption()`](docs/api-methods.md#getmonthlyconsumption)Fetch month-by-month consumption history[`getConsumptionValues()`](docs/api-methods.md#getconsumptionvalues)Fetch consumption for a specific billing periodSee [API Methods](docs/api-methods.md) for full parameter documentation and examples.

Data objects
------------

[](#data-objects)

All API responses are returned as readonly DTOs with typed properties. Every DTO provides `fromArray()` and `toArray()` for serialization.

ClassDescription[`UserValuesResult`](docs/data-objects.md#uservaluesresult)Top-level response with customers[`Customer`](docs/data-objects.md#customer)A customer with address and consumption data[`ConsumptionPeriod`](docs/data-objects.md#consumptionperiod)A billing period with services, meters, and temperatures[`ServiceComparison`](docs/data-objects.md#servicecomparison)Current vs. previous year totals for a service type[`Meter`](docs/data-objects.md#meter)A single meter reading with all technical fields[`BillingService`](docs/data-objects.md#billingservice)Service type definition (e.g. Heating, Hot Water)[`BillingPeriod`](docs/data-objects.md#billingperiod)A billing year with start/end dates[`ConsumptionAverageResult`](docs/data-objects.md#consumptionaverageresult)Building average consumption[`ConsumptionValuesResult`](docs/data-objects.md#consumptionvaluesresult)Consumption data for a specific billing period[`MonthlyConsumptionResult`](docs/data-objects.md#monthlyconsumptionresult)Monthly consumption history[`MonthlyConsumption`](docs/data-objects.md#monthlyconsumption)A single month's consumption[`MonthlyServiceConsumption`](docs/data-objects.md#monthlyserviceconsumption)Per-service totals for a month[`MonthlyDeviceConsumption`](docs/data-objects.md#monthlydeviceconsumption)Per-device readings for a monthSee [Data Objects](docs/data-objects.md) for all properties and types.

Caching
-------

[](#caching)

Pass any PSR-16 `CacheInterface` to cache API responses and the JWT token:

```
$ista = new Ista(
    username: 'your@email.com',
    password: 'your-password',
    cache: new YourPsr16Cache(),
    cacheTtl: 86400, // 24 hours
);
```

Cache keys used:

Key patternData`ista:jwt`Authentication token`ista:user-values``getUserValues()` response`ista:consumption-averages:{cuid}:{start}:{end}``getConsumptionAverages()` response`ista:monthly-consumption:{cuid}``getMonthlyConsumption()` response`ista:consumption-values:{cuid}:{year}:{start}:{end}``getConsumptionValues()` responseCache failures are silently ignored -- the client will re-fetch from the API.

Error handling
--------------

[](#error-handling)

All errors are wrapped in a single exception class:

```
use NiekNijland\Ista\Exception\IstaException;

try {
    $result = $ista->getUserValues();
} catch (IstaException $e) {
    // Authentication failures, HTTP errors, malformed responses
    // Original exception is available via $e->getPrevious()
}
```

Testing
-------

[](#testing)

The package ships testing utilities so you can mock the Ista client in your application tests without making real API calls.

```
use NiekNijland\Ista\Testing\FakeIsta;
use NiekNijland\Ista\Testing\UserValuesResultFactory;

$fake = new FakeIsta();
$fake->seedUserValuesResult(UserValuesResultFactory::make());

$result = $fake->getUserValues();

$fake->assertCalled('getUserValues');
$fake->assertCalledTimes('getUserValues', 1);
```

See [Testing](docs/testing.md) for full documentation of `FakeIsta`, all factories, and recorded call inspection.

Development
-----------

[](#development)

```
composer test              # Unit tests
composer test-integration  # Integration tests (requires ISTA_USERNAME and ISTA_PASSWORD)
composer test-all          # All test suites
composer analyse           # PHPStan level 8
composer format            # Laravel Pint
composer rector            # Rector automated refactoring
composer codestyle         # Full pipeline: Rector + Pint + PHPStan
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance85

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

101d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4d9cb12c53e7e4ec9fdc27f74e8bbd725c61a8280780cffe7136c74f1df7570e?d=identicon)[NiekNijland](/maintainers/NiekNijland)

---

Top Contributors

[![NiekNijland](https://avatars.githubusercontent.com/u/43474728?v=4)](https://github.com/NiekNijland "NiekNijland (10 commits)")

---

Tags

istaphpenergyheatingconsumptionista

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nieknijland-ista-php/health.svg)

```
[![Health](https://phpackages.com/badges/nieknijland-ista-php/health.svg)](https://phpackages.com/packages/nieknijland-ista-php)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k532.1M19.4k](/packages/laravel-framework)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.2M46](/packages/tencentcloud-tencentcloud-sdk-php)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

749284.3k35](/packages/civicrm-civicrm-core)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2478.1k](/packages/filescom-files-php-sdk)[aimeos/prisma

A powerful PHP package for integrating media related Large Language Models (LLMs) into your applications

1772.4k4](/packages/aimeos-prisma)

PHPackages © 2026

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