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 5mo ago1 watchersCompare

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

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

32

—

LowBetter than 72% of packages

Maintenance48

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

1549d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c2b78b66177d59956c1f4d90b601383e484d4cc0a45e4b8657aad52d2c6f4e88?d=identicon)[cowshedworks](/maintainers/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

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[carbonphp/carbon-doctrine-types

Types to use Carbon in Doctrine

213220.4M8](/packages/carbonphp-carbon-doctrine-types)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)[wildside/userstamps

Laravel Userstamps provides an Eloquent trait which automatically maintains `created\_by` and `updated\_by` columns on your model, populated by the currently authenticated user in your application.

7511.7M13](/packages/wildside-userstamps)

PHPackages © 2026

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