Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Holicz committed Mar 30, 2020
1 parent a1e2e72 commit 081120a
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Installation
```
composer require holicz/pvgis
```

# Requirements
* PHP >= 7.4

# Usage
```
<?php
use holicz\PVIGS\PVGIS;
$latitude = '50.0898689';
$longitude = '14.4000936';
$pvigs = new PVGIS();
$electricityProduction = $pvgis->getElectricityProduction($latitude, $longitude);
// Yearly sum of production
$electricityProduction->getYearlyProduction();
foreach ($electricityProduction->getMonthlyProductions() as $monthlyProduction) {
// Month number
$monthlyProduction->getMonth();
// Sum of the monthly production
$monthlyProduction->getProduction();
}
```
8 changes: 8 additions & 0 deletions src/Model/ElectricityProduction.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ public function addMonthlyProduction(int $month, float $production): self
return $this;
}

/**
* @return MonthlyProduction[]
*/
public function getMonthlyProductions(): array
{
return $this->monthlyProductions;
}

public function getYearlyProduction(): float
{
return $this->yearlyProduction;
Expand Down

0 comments on commit 081120a

Please sign in to comment.