定制 ahoicloud/co2 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ahoicloud/co2

最新稳定版本:v1.0.2

Composer 安装命令:

composer require ahoicloud/co2

包简介

Package for laravel calculating Co2 emission based on Sustainable Web Design (SWD) model

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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 Sustainable Web Design (SWD) model. The yearly average grid intensity data comes 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 is based on the great work done by The Green Web Foundation in the CO2.js package.

Installation

You can install the package via composer:

composer require ahoicloud/co2

Optional

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,

];

Usage

Total energy use by each corresponding system component in kilowatt hours

$co2 = new Ahoicloud\Co2();
echo $co2->energyPerByteByComponent($byte);

Or as a facade

use Ahoicloud\Co2\Facades\Co2;
echo Co2::energyPerByteByComponent($byte);

Total co2 figures key by the each component

$co2 = new Ahoicloud\Co2();
echo $co2->co2byComponent($byte);

Or as a facade

use Ahoicloud\Co2\Facades\Co2;
echo Co2::co2byComponent($byte);

Total co2 figures key by the each component

$co2 = new Ahoicloud\Co2();
echo $co2->perByte($byte);

Or as a facade

use Ahoicloud\Co2\Facades\Co2;
echo Co2::perByte($byte);

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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.

统计信息

  • 总下载量: 12
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固