Every byte of data that’s uploaded or downloaded produces CO2. By being able to calculate these emissions, developers can enabled themself and their users to create more efficient, lower carbon decisions. Here are a few examples:
- Create a carbon budget for your site
- Inform the user when they uploading or downloading carbon intensive files
The package uses the yearly average grid intensity data from Ember, as well as marginal intensity data from the UNFCCC (United Nations Framework Convention on Climate Change).
The package is build for Laravel and heavy inspired by thegreenwebfoundation/co2.js
You can install the package via composer:
composer require ahoicloud/co2
You can publish the config file with:
php artisan vendor:publish --tag="co2-config"
This is the contents of the published config file:
return [
'KWH_PER_GB' => 0.81,
'END_USER_DEVICE_ENERGY' => 0.52,
'NETWORK_ENERGY' => 0.14,
'DATACENTER_ENERGY' => 0.15,
'PRODUCTION_ENERGY' => 0.19,
'GLOBAL_GRID_INTENSITY' => 442,
'RENEWABLES_GRID_INTENSITY' => 50,
'FIRST_TIME_VIEWING_PERCENTAGE' => 0.75,
'RETURNING_VISITOR_PERCENTAGE' => 0.25,
'PERCENTAGE_OF_DATA_LOADED_ON_SUBSEQUENT_LOAD' => 0.02,
];
$co2 = new Ahoicloud\Co2();
echo $co2->energyPerByteByComponent($byte);
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.
The code for thegreenwebfoundation/co2.js is licensed Apache 2.0. (What does this mean?)
The average carbon intensity data from Ember is published under the Creative Commons ShareAlike Attribution Licence (CC BY-SA 4.0). (What does this mean?)
The marginal intensity data is published by the Green Web Foundation, under the Creative Commons ShareAlike Attribution Licence (CC BY-SA 4.0). (What does this mean?)
See LICENCE for more.