PHPackages                             chartbeat/chartbeat-php - 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. chartbeat/chartbeat-php

ActiveLibrary

chartbeat/chartbeat-php
=======================

PHP library for Chartbeat

1.0.0(12y ago)59.5k1MITPHPPHP &gt;=5.3.0

Since Jun 27Pushed 12y ago3 watchersCompare

[ Source](https://github.com/eeroniemi/chartbeat-php)[ Packagist](https://packagist.org/packages/chartbeat/chartbeat-php)[ Docs](http://github.com/eeroniemi/chartbeat-php)[ RSS](/packages/chartbeat-chartbeat-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

chartbeat-php
=============

[](#chartbeat-php)

PHP library to interact with Chartbeat API.

See great [API docs](http://chartbeat.com/docs/api/) and [API explorer](http://chartbeat.com/docs/api/explore/) from [Chartbeat website](http://chartbeat.com) for more info.

This library requires PHP &gt;5.3 and cURL extension for PHP to work. Tested with PHP 5.3.15 and 5.4.6

Please give feedback, report bugs, fork and contribute.

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

[](#installation)

Add chartbeat-php to your composer.json:

```
{
	"require" : {
		"chartbeat/chartbeat-php" : "1.*"
	}
}
```

Simple test script:

```
require_once ('vendor/autoload.php'); // composer autoloader
$apiKey = '';
$host = '';
$cb = new Chartbeat\Chartbeat($host, $apiKey);

// get monthly max people on site
echo 'Monthly max people on the site: ' . $cb->getMonthlyMaxPeople();
```

You can also do any kind of API query using get() method. First parameter is data endpoint (eg. 'historical/traffic/series'), seconds one contains parameters.

In here, we get top referer of page which has most visitors right now:

```
$cbData = $cb->get('live/toppages/v3/', array('limit' => 1)); // get all top pages, we want only 1
$topPage = current($cbData->pages); // get first page of the result
var_dump(current($topPage->stats->toprefs)); // output first top referer of page

// outputs:
object(stdClass)#9 (2) {
  ["visitors"]=>
  int(10)
  ["domain"]=>
  string(10) "google.com"
}
```

Error handling
--------------

[](#error-handling)

Every error throws exception Chartbeat\\Exception.

```
try {
	// set invalid key and try to get data
	$cb->setApiKey('invalidapikey');
	$cb->getMonthlyMaxPeople();
} catch (Chartbeat\Exception $ex)
{
	echo "Caught exception: " . $ex->getMessage();
	// will output "Caught exception: Chartbeat API error. Message: No Access, Code: 403"
}
```

Testing
-------

[](#testing)

You can test this library by running example.php with:

```
./example.php

```

This will output monthly max people your site

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4706d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/532180da9ddc38c108c69ee1bb2cb632d2e68b27609e1e930c370cf0d2ac4198?d=identicon)[eeroniemi](/maintainers/eeroniemi)

---

Top Contributors

[![eeroniemi](https://avatars.githubusercontent.com/u/1384231?v=4)](https://github.com/eeroniemi "eeroniemi (8 commits)")

---

Tags

chartbeat

### Embed Badge

![Health badge](/badges/chartbeat-chartbeat-php/health.svg)

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

PHPackages © 2026

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