PHPackages                             green-elephpant/carbon-aware - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. green-elephpant/carbon-aware

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

green-elephpant/carbon-aware
============================

SDK to help your applications reduce carbon emissions

0.0.2(1y ago)18[1 issues](https://github.com/green-elephpant/carbon-aware/issues)[2 PRs](https://github.com/green-elephpant/carbon-aware/pulls)MITPHPPHP &gt;=7.4CI passing

Since Aug 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/green-elephpant/carbon-aware)[ Packagist](https://packagist.org/packages/green-elephpant/carbon-aware)[ RSS](/packages/green-elephpant-carbon-aware/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (6)Used By (0)

 [![Green ElePHPant](./docs/images/green-elephpant-logo.svg)](./docs/images/green-elephpant-logo.svg)

Green ElePHPant - CarbonAware
=============================

[](#green-elephpant---carbonaware)

The **Green ElePHPant** wants to help you to reduce the carbon emissions of your software.

One way of doing so is to utilize energy when it is the "greenest" - i.e., when it most of it comes from renewable energies rather burning fossil fuels.

`GreenElephpant\CarbonAware` is a simple wrapper for APIs that provide information about the current or future carbon intensity at many regions worldwide. Currently, we support [CO2Signal](https://www.co2signal.com/) and [Electricity Maps](https://www.electricitymaps.com/). Hopefully more to come!

Key concept
-----------

[](#key-concept)

Building carbon aware applications means that certain activities or jobs will not, or at least in lower frequency, be carried out if the carbon intensity is too high.

For example, if the carbon intensity is low, we can update a dashboard more often than if it is not:

```
if ($carbonAwareService->isLow()) {
    $schedule
        ->command('dashboard:update')
        ->everyFiveMinutes();
} else {
    $schedule
        ->command('dashboard:update')
        ->everyTenMinutes();
}
```

Installation
------------

[](#installation)

Simply use composer to add `GreenElephpant\CarbonAware` to your project:

`composer require green-elephpant/carbon-aware`

Configuration
-------------

[](#configuration)

`GreenElephpant\CarbonAware` was designed to require as few external dependencies as possible so that it can fit in almost every project. It uses several PSR for e.g. HTTP messages (PSR-17) and clients (PSR-18), so it won't work out of the box but require a bit (but not a lot) of hand wiring.

```
use Buzz\Client\Curl;
use GreenElephpant\CarbonAware\DataProvider\EnergyCharts\Connector\EnergyChartsConnector;
use GreenElephpant\CarbonAware\DataProvider\EnergyCharts\EnergyCharts;
use GreenElephpant\CarbonAware\Service\CarbonAwareService;
use Nyholm\Psr7\Factory\Psr17Factory;

// Create HTTP client with HTTP message factory
// E.g. nyholm/psr7 and kriswallsmith/buzz
$psr17Factory = new Psr17Factory();
$psr18Client = new Curl($psr17Factory);

// Create Connector (here: for energy-charts.info)
$energyChartsConnector = new EnergyChartsConnector(
    $psr18Client,
    $psr17Factory,
);

// Setup location (the region of the world you want to get the information for)
$location = new GreenElephpant\CarbonAware\Location\Location('DE');

// Finally create the DataProvider instance, using the connector and the location
$dataProvider = new EnergyCharts(
    $co2SignalConnector,
    $location
);

$carbonAwareService = new CarbonAwareService($connector
```

Internals
---------

[](#internals)

`GreenElephpant\CarbonAware` uses 3rd party APIs to receive carbon intensity data. To ensure future-proof and easy maintenance,

- `Connector`: the actual API wrapper. Provides easy access to the relevant API endpoints (note: only those endpoints that are relevant for this project are supported.
- `DataProvider`: the link between
- `CarbonAwareService`: provides uniform API

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 86% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

723d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4761678d271eef1bc9fc3478994848dd54b6d77551e3c065b1b730b5badffb90?d=identicon)[carstenwindler](/maintainers/carstenwindler)

---

Top Contributors

[![carstenwindler](https://avatars.githubusercontent.com/u/5927645?v=4)](https://github.com/carstenwindler "carstenwindler (37 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/green-elephpant-carbon-aware/health.svg)

```
[![Health](https://phpackages.com/badges/green-elephpant-carbon-aware/health.svg)](https://phpackages.com/packages/green-elephpant-carbon-aware)
```

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

81733.7k](/packages/flow-php-flow)[laudis/neo4j-php-client

Neo4j-PHP-Client is the most advanced PHP Client for Neo4j

184616.9k31](/packages/laudis-neo4j-php-client)[neos/flow

Flow Application Framework

862.0M451](/packages/neos-flow)[unleash/client

633.1M8](/packages/unleash-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
