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

ActiveLibrary

showclix/cube-php
=================

A PHP client for Cube

0.1.3(5y ago)84.7k51MITPHPPHP &gt;=5.3

Since Feb 28Pushed 5y ago31 watchersCompare

[ Source](https://github.com/ShowClix/cube-php)[ Packagist](https://packagist.org/packages/showclix/cube-php)[ Docs](http://github.com/ShowClix/cube-php)[ RSS](/packages/showclix-cube-php/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (6)Used By (1)

Cube Client for PHP
===================

[](#cube-client-for-php)

Cube Client that supports communicating with a [Cube](https://github.com/square/cube) collector and evaluator.

Usage
=====

[](#usage)

```
// Create a Client pointed at a local collector and evaluator
$client = \Cube\Client::createHttpClient(array(
    'collector' => array(
        'host' => 'localhost',
        'port' => 1080,
    ),
    'evaluator' => array(
        'host' => 'localhost',
        'port' => 1081,
    ),
    'secure' => true,
));

$res = $client->metricGet(array(
    'expression' => 'sum(cube_request)',
    'step' => \Cube\Client::INT_ONE_MINUTE,
    'limit' => 100,
));

echo "There were {$res[0]['value']} hits during {$res[0]['time']}";
```

Install
=======

[](#install)

Via composer

```
composer.phar install showclix/cube-php

```

API
===

[](#api)

\\Cube\\Client
--------------

[](#cubeclient)

### \[static\] createHttpClient(array $conf)

[](#static-createhttpclientarray-conf)

param array $conf

Configuration array. For example:

```
array(
    'collector' => array(
        'host' => 'localhost',
        'port' => 1080,
    ),
    'evaluator' => array(
        'host' => 'localhost',
        'port' => 1081,
    ),
    'secure' => true,
)
```

return \\Cube\\Client

### eventPut(array $event)

[](#eventputarray-event)

param array $event

The event to push to cube. Requires type, time and data options.

```
array(
    'type' => 'example',
    'time' => time(),
    'data' => array(
        'key' => 'value',
    ),
)
```

returns array response from Cube

### eventGet(array $query)

[](#eventgetarray-query)

param array $query

returns array

*EXAMPLE*

```
$query = array(
    'expression' => 'request.eq(path, "search")',   // cube expression
    'limit' => 10,                                  // limit (optional)
);
$client->metricGet($query);
```

### metricGet(array $query)

[](#metricgetarray-query)

param array $query Metric query to send to cube evaluator

returns array

*EXAMPLE*

```
$query = array(
    'expression' => 'sum(type_name)',   // cube expression
    'start' => strtotime('-1 day'),     // start time (optional)
    'stop' => time(),                   // end time (optional)
    'limit' => 10,                      // limit (optional)
    'step' => Client::INT_ONE_MINUTE,   // time grouping interval
);
$res = $client->metricGet($query);
echo "There were {$res[0]['value']} during {$res[0]['time']}";
```

### typesGet()

[](#typesget)

returns array of all types currently in cube

Todo
====

[](#todo)

- Implement \\Cube\\Connection\\WebSocketConnection
- Implement \\Cube\\Connection\\UdpConnection
- Add Travis CI Integaration complete with hooks to setup and install Cube/Mongo

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~735 days

Total

5

Last Release

1885d ago

### Community

---

Top Contributors

[![lmammino](https://avatars.githubusercontent.com/u/205629?v=4)](https://github.com/lmammino "lmammino (1 commits)")[![momorgan7](https://avatars.githubusercontent.com/u/9384650?v=4)](https://github.com/momorgan7 "momorgan7 (1 commits)")[![nategood](https://avatars.githubusercontent.com/u/154115?v=4)](https://github.com/nategood "nategood (1 commits)")

### Embed Badge

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

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

PHPackages © 2026

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