Skip to content

Commit 318a399

Browse files
committed
Updating ServiceProvider and remove db migration stub
1 parent 552c5bb commit 318a399

File tree

7 files changed

+33
-42
lines changed

7 files changed

+33
-42
lines changed

README.md

+31-1
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,42 @@ return [
5151

5252

5353
## Usage
54-
54+
### Total energy use by each corresponding system component in kilowatt hours
5555
```php
5656
$co2 = new Ahoicloud\Co2();
5757
echo $co2->energyPerByteByComponent($byte);
5858
```
59+
Or as a facade
60+
61+
```php
62+
use Ahoicloud\Co2\Facades\Co2;
63+
echo Co2::energyPerByteByComponent($byte);
64+
```
65+
66+
67+
### Total co2 figures key by the each component
68+
```php
69+
$co2 = new Ahoicloud\Co2();
70+
echo $co2->co2byComponent($byte);
71+
```
72+
Or as a facade
5973

74+
```php
75+
use Ahoicloud\Co2\Facades\Co2;
76+
echo Co2::co2byComponent($byte);
77+
```
78+
79+
### Total co2 figures key by the each component
80+
```php
81+
$co2 = new Ahoicloud\Co2();
82+
echo $co2->perByte($byte);
83+
```
84+
Or as a facade
85+
86+
```php
87+
use Ahoicloud\Co2\Facades\Co2;
88+
echo Co2::perByte($byte);
89+
```
6090
## Testing
6191

6292
```bash

database/factories/.gitkeep

Whitespace-only changes.

database/factories/ModelFactory.php

-19
This file was deleted.

database/migrations/.gitkeep

Whitespace-only changes.

database/migrations/create_co2_table.php.stub

-19
This file was deleted.

src/Co2.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Co2
1010

1111
/**
1212
* Accept a figure for bytes transferred and return an object representing
13-
* the share of the total enrgy use of the entire system, broken down
13+
* the share of the total energy use of the entire system, broken down
1414
* by each corresponding system component
1515
* Gets emission by Sustainable Web Design
1616
* https://sustainablewebdesign.org/calculating-digital-emissions/.
@@ -97,6 +97,7 @@ public function co2byComponent($energyByComponent, $carbonIntensity = false)
9797
*
9898
* @param $bytes - the data transferred in bytes
9999
* @param bool $carbonIntensity the carbon intensity for datacentre (average figures, not marginal ones)
100+
* @param bool $segmentResults the result should return as segmentet
100101
* @return float|null|array the total number in grams of CO2 equivalent emissions
101102
*/
102103
public function perByte($bytes, $carbonIntensity = false, $segmentResults = false, $options = [])

src/Co2ServiceProvider.php

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ public function configurePackage(Package $package): void
1818
$package
1919
->name('co2')
2020
->hasConfigFile()
21-
->hasViews()
22-
->hasMigration('create_co2_table')
2321
->hasCommand(Co2Command::class);
2422
}
2523
}

0 commit comments

Comments
 (0)