PHPackages                             cowshedworks/trees - 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. [Database &amp; ORM](/categories/database)
4. /
5. cowshedworks/trees

ActiveLibrary[Database &amp; ORM](/categories/database)

cowshedworks/trees
==================

Tree Database

0.3.6(4y ago)038MITPHPPHP &gt;=7.4

Since Jan 5Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/cowshedworks/trees)[ Packagist](https://packagist.org/packages/cowshedworks/trees)[ RSS](/packages/cowshedworks-trees/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (4)Versions (24)Used By (0)

Tree Data
=========

[](#tree-data)

The aim of this project is to provide a simple api for calculating data about UK native trees.

The provided PHP utilities can be used to get data about a range of tree species. It can work out the CO2 sequestration rate for trees. The data is used as the base data in the Forest Of One Project.

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

[](#installation)

Use the package manager [composer](https://getcomposer.org/) to install.

```
composer require cowshedworks/trees
```

Using the Tree Data API
-----------------------

[](#using-the-tree-data-api)

The tree data factory will return a tree data object that can be used to calculate various things about the tree.

```
use CowshedWorks\Trees\TreeDataFactory;

$factory = new TreeDataFactory();
print_r($factory->getTrees());

// prints ['alder', 'birch', 'oak']
```

To instantiate a tree data object you need to pass parameters to the factory, it requires 'circumference' and 'height' in order to build the object. You can also pass it an observed date 'YYYY-MM-DD'. Parameters can be passed to the factory either as an array in the build method or chained before calling build. For example:

```
$treeData = $factory->build('alder', [
  'circumference' => '22in',
  'height'   => '15ft'
]);
```

or

```
$treeData = $factory->circumference('22in')->height('15ft')->build('alder');
```

It will setup the tree object and calculate some information about it from the circumference and height, it will also work out an approximate age. If an observed date is provided it will attempt to extrapolate the data up to the current date.

```
echo $treeData->getPopularName();
// Alder
print_r($treeData->getCommonNames());
// Array
// (
//     [0] => Alder
//     [1] => Common Alder
//     [2] => Black Alder
//     [3] => European Alder
// )
print_r($treeData->getScientificName());
// Array
// (
//     [0] => Alnus glutinosa
// )
echo $treeData->getEstimatedAge();
// 10 years
echo $treeData->getCarbonWeight();
// 36.3 kg
echo $treeData->getCO2SequestrationPerYear();
// 13.31 kg
echo $treeData->getCO2SequestrationToDate();
// 133.09
```

Contributing
------------

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance45

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.2% 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 ~19 days

Recently: every ~10 days

Total

22

Last Release

1596d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25663396?v=4)[Gavin Phillips](/maintainers/cowshedworks)[@cowshedworks](https://github.com/cowshedworks)

---

Top Contributors

[![cowshedworks](https://avatars.githubusercontent.com/u/25663396?v=4)](https://github.com/cowshedworks "cowshedworks (353 commits)")[![SusannaPhillips](https://avatars.githubusercontent.com/u/30229702?v=4)](https://github.com/SusannaPhillips "SusannaPhillips (12 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (2 commits)")

---

Tags

carbontreesCO2sequestration

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/cowshedworks-trees/health.svg)

```
[![Health](https://phpackages.com/badges/cowshedworks-trees/health.svg)](https://phpackages.com/packages/cowshedworks-trees)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M117](/packages/jdorn-sql-formatter)[carbonphp/carbon-doctrine-types

Types to use Carbon in Doctrine

220257.6M10](/packages/carbonphp-carbon-doctrine-types)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)[omaralalwi/laravel-time-craft

Laravel Time Craft is a powerful package for handling date and time scopes in your Laravel applications. It provides a set of convenient traits and helper functions to simplify date and time operations.

131.3k](/packages/omaralalwi-laravel-time-craft)

PHPackages © 2026

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