This PHP package provides a client for fetching dynamic energy prices from the EnergyZero API. It allows you to retrieve energy prices for a specified date range with customizable intervals and VAT options.
You can install the package via composer:
composer require baspa/energyzero-php-api
You can fetch the energy prices for a specific date range with a specific interval and VAT option. When the VAT option is not provided, it will default to true
. Make sure you provide a date in the format Y-m-d
.
use Baspa\EnergyZero;
$prices = (new EnergyZero())->energyPrices(
startDate: '2024-01-01',
endDate: '2024-01-02',
interval: 4,
vat: true
);
The response will be an array of prices for the specified date range and also include the average price for the period.
$lowestPrice = (new EnergyZero())->getLowestPriceForPeriod(
startDate: '2024-01-01',
endDate: '2024-01-02',
vat: true
);
$highestPrice = (new EnergyZero())->getHighestPriceForPeriod(
startDate: '2024-01-01',
endDate: '2024-01-02',
vat: true
);
$prices = (new EnergyZero())->getPricesAboveThreshold(
startDate: '2024-01-01',
endDate: '2024-01-02',
threshold: 0.05,
vat: true
);
$prices = (new EnergyZero())->getPricesBelowThreshold(
startDate: '2024-01-01',
endDate: '2024-01-02',
threshold: 0.05,
vat: true
);
Get the top N peak hours for a period.
$peakHours = (new EnergyZero())->getPeakHours(
startDate: '2024-01-01',
endDate: '2024-01-02',
topN: 5,
vat: true
);
Get the top N valley hours for a period.
$valleyHours = (new EnergyZero())->getValleyHours(
startDate: '2024-01-01',
endDate: '2024-01-02',
topN: 5,
vat: true
);
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.