holicz/pvgis

Package to provide solar electricity production by GPS coordinates from PVGIS

Maintainers

Package info

github.com/Holicz/pvgis

pkg:composer/holicz/pvgis

Statistics

Installs: 883

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

2.2 2022-03-24 15:46 UTC

This package is auto-updated.

Last update: 2026-02-25 00:17:41 UTC


README

composer require holicz/pvgis

Requirements

  • PHP ^7.4|^8.0

Usage

Basic usage

<?php

use holicz\PVGIS\PVGIS;
use holicz\PVGIS\Adapter\PvgisAdapter;
use holicz\PVGIS\Enum\Database;

$latitude = '50.0898689';
$longitude = '14.4000936';

$pvgis = new PVGIS(new PvgisAdapter());
$electricityProduction = $pvgis->getElectricityProduction(
    $latitude,
    $longitude,
    35, // Solar panels angle (not required)
    CardinalDirection::SOUTH, // Solar panels azimuth (not required)
    Database::SARAH // Name of the radiation database (not required)
);

// Yearly sum of production
$electricityProduction->getYearlyProduction();

foreach ($electricityProduction->getMonthlyProductions() as $monthlyProduction) {
    // Month number
    $monthlyProduction->getMonth();
    // Sum of the monthly production
    $monthlyProduction->getProduction();
}

Using multiplier

If you for example know that you have six solar panels and the production is 1.86x time more bigger than the PVGIS result you should use the multiplier method

$electricityProduction->multiply(1.86);