PHPackages                             bigtallbill/php-mongo-graph-model - 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. bigtallbill/php-mongo-graph-model

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

bigtallbill/php-mongo-graph-model
=================================

A data model for storing incremental data for graphs

1750PHP

Since Aug 25Pushed 10y ago2 watchersCompare

[ Source](https://github.com/bigtallbill/php-graph-data-manager)[ Packagist](https://packagist.org/packages/bigtallbill/php-mongo-graph-model)[ RSS](/packages/bigtallbill-php-mongo-graph-model/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

php-graph-data-manager
======================

[](#php-graph-data-manager)

A small library that helps store graph-type (incremental stats) in mongo database using doctrine ODM

Installation
============

[](#installation)

Add this to your composer.json

```
"require": {
    "bigtallbill/php-mongo-graph-model": "dev-master"
}

```

Usage
=====

[](#usage)

```

// instantiate a new instance providing the doctrine DocumentManager instance
$gm = new GraphManager($dm);

$gm->setGranularity(GraphManager::MINUTE);
$gm->setWindow(GraphManager::HOUR);

// create a random statistic to store. These are instances of ParsedStat
// and can be created manually if required
$stat = $gm->parseSimpleKeyValue('system_stats', 'cpu', rand(25, 50));

// finally run an upsert using doctrine to create or update the stat
$gm->insertStat($stat);

```

How this model looks
====================

[](#how-this-model-looks)

Using a granularity of Hours and a window of Days:

```
{
    "_id" : ObjectId("5560b3b7919124c4e03710fd"),
    "date" : ISODate("2015-05-23T00:00:00.000Z"),
    "granularity" : NumberLong(3600),
    "group" : "system_stats",
    "key" : "mem",
    "window" : NumberLong(86400),
    "window_human" : "Day",
    "granularity_human" : "Hour",
    "segments" : {
        "1432400400" : NumberLong(108588),
        "1432404000" : NumberLong(119624)
    }
}

```

Under the *segments* key is where each segment of granularity is stored (in our case the top of the current hour). The *date* is locked to the top of the current window (in our case the current day)

Here is another example with a granularity of minutes and a window of hours:

```
{
    "_id" : ObjectId("5560c023919124c4e0371102"),
    "date" : ISODate("2015-05-23T18:00:00.000Z"),
    "granularity" : NumberLong(60),
    "group" : "system_stats",
    "key" : "processes",
    "window" : NumberLong(3600),
    "window_human" : "Hour",
    "granularity_human" : "Minute",
    "segments" : {
        "1432404000" : NumberLong(59041),
        "1432404060" : NumberLong(41138),
        "1432404120" : NumberLong(62544),
        "1432404180" : NumberLong(59392),
        "1432404240" : NumberLong(22948),
        "1432404300" : NumberLong(58825),
        "1432404360" : NumberLong(31936),
        "1432404420" : NumberLong(17407),
        "1432404480" : NumberLong(30097),
        "1432404540" : NumberLong(54094),
        "1432404600" : NumberLong(34739),
        "1432404660" : NumberLong(34164),
        "1432404720" : NumberLong(34571),
        "1432404780" : NumberLong(28592)
    }
}

```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/8caa9b48729c93df3849117fd3973e801748d871e786d53c7ff00c14c8563a43?d=identicon)[bigtallbill](/maintainers/bigtallbill)

---

Top Contributors

[![bigtallbill](https://avatars.githubusercontent.com/u/727370?v=4)](https://github.com/bigtallbill "bigtallbill (10 commits)")

### Embed Badge

![Health badge](/badges/bigtallbill-php-mongo-graph-model/health.svg)

```
[![Health](https://phpackages.com/badges/bigtallbill-php-mongo-graph-model/health.svg)](https://phpackages.com/packages/bigtallbill-php-mongo-graph-model)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

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

8351.6M87](/packages/propel-propel1)[pgvector/pgvector

pgvector support for PHP

198741.5k12](/packages/pgvector-pgvector)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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