PHPackages                             beebotte/bbt\_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. beebotte/bbt\_php

ActiveLibrary

beebotte/bbt\_php
=================

PhP library for interfacing with Beebotte

257[1 issues](https://github.com/beebotte/bbt_php/issues)PHP

Since Jul 13Pushed 6y ago1 watchersCompare

[ Source](https://github.com/beebotte/bbt_php)[ Packagist](https://packagist.org/packages/beebotte/bbt_php)[ RSS](/packages/beebotte-bbt-php/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Beebotte PHP SDK
================

[](#beebotte-php-sdk)

whatwhereoverviewtutorialsapidocsource[https://github.com/beebotte/bbt\_php](https://github.com/beebotte/bbt_php)### Bugs / Feature Requests

[](#bugs--feature-requests)

Think you have found a bug? Want to see a new feature in Beebotte? Please open an issue in github. Please provide as much information as possible about the issue type and how to reproduce it.

[https://github.com/beebotte/bbt\_php/issues](https://github.com/beebotte/bbt_php/issues)

Install
-------

[](#install)

The Beebotte PHP library is available as a `composer` package called `bbt_php` (See [https://packagist.org/packages/beebotte/bbt\_php](https://packagist.org/packages/beebotte/bbt_php)).

```
composer require beebotte/bbt_php

```

Or add the following to `composer.json` in your project:

```
"require": {
    "beebotte/bbt_php": "*"
}

```

and then run `composer update`.

If you don't have composer, you can still get Beebotte PHP library by cloning the project from github:

```
git clone https://github.com/beebotte/bbt_php.git

```

or by downloading the library source files.

Usage
-----

[](#usage)

To use the library, you need to be a registered user. If this is not the case, create your account at  and note your access credentials.

As a reminder, Beebotte resource description uses a two levels hierarchy:

- Channel: physical or virtual connected object (an application, an arduino, a coffee machine, etc) providing some resources
- Resource: most elementary part of Beebotte, this is the actual data source (e.g. temperature from a domotics sensor)

### Beebotte Constructor

[](#beebotte-constructor)

Use your account api and secret keys to initialize Beebotte connector:

```
  $api_key    = 'YOUR_API_KEY';
  $secret_key = 'YOUR_SECRET_KEY';
  $bbt = new Beebotte($api_key, $secret_key);

```

### Reading Data

[](#reading-data)

You can read data from one of your channel resources using:

```
  $records = $bbt->read("channel1", "resource1", 5 /* read last 5 records */);

```

You can read data from a public channel by specifying the channel owner:

```
  $records = $bbt->publicRead("owner", "channel1", "resource1", 5 /* read last 5 records */);

```

### Writing Data

[](#writing-data)

You can write data to a resource of one of your channels using:

```
  $bbt->write("channel1", "resource1", "Hello Horld");

```

If you have multiple records to write (to one or multiple resources of the same channel), you can use the `bulk write` method:

```
  $bbt->writeBulk("channel1", array(array("resource" => "resource1", "data" => "Hello"), array("resource" => "resource2", "data" => "World")));

```

### Publishing Data

[](#publishing-data)

You can publish data to a channel resource using:

```
  $bbt->publish("any_channel", "any_resource", "Hello World");

```

Published data is transient. It will not saved to any database; rather, it will be delivered to active subscribers in real time. The Publish operations do not require that the channel and resource be actually created. They will be considered as virtual: the channel and resource exist as long as you are publishing data to them. By default, published data is public, publish a private message, you need to add `private-` prefix to the channel name like this:

```
  $bbt->publish("private-any_channel", "any_resource", "Hello World");

```

If you have multiple records to publish (to one or multiple resources of the same channel), you can use the `bulk publish` method:

```
  $bbt->publishBulk("channel1", array(array("resource" => "resource1", "data" => "Hello"), array("resource" => "resource2", "data" => "World")));

```

### Resource Object

[](#resource-object)

The library provides a Resource Class that can be used as follows

```
  //Create the resource object
  $resource = new Resource($bbt, "channel1", "resource1");

  //Read data from public resource
  $records = $resource->read("owner", 2 /* last 2 records */);

  //Read data
  $records = $resource->read(null, 2 /* last 2 records */);

  //Read the last written record
  $record = $resource->recentValue();

  //Write data
  $resource->write("Hello World");

  //Publish data
  $resource->publish("Hola amigo");

```

### Signing `subscribe` Requests

[](#signing-subscribe-requests)

As described in , you need to implement an `authentication endpoint` to grant users of your Web application access to privileged channel resources on your Beebotte account.

The library provides utility functions to simplify the implementation of such endpoints:

```
  // authenticate client subscribe request given all parameters
  $sig = $bbt->auth_client($sid, $channel, $resource, $ttl, $read, $write);

```

you can also build the string to sign yourself and feed it to the library to get it signed:

```
  $r = $read ? "true" : "false";
  $w = $write? "true" : "false";
  $stringToSign = $sid . ":" . $channel . "." . $resource . ":ttl=" . $ttl . ":read=" . $r . ":write=" . $w;
  $sig = $bbt->sign($stringToSign);

```

License
-------

[](#license)

Copyright 2013 - 2019 Beebotte.

[The MIT License](http://opensource.org/licenses/MIT)

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 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/da259b96bcd6622c10c895764672c2086e0980bf4e7aa07717b84ce95123d211?d=identicon)[beebotte](/maintainers/beebotte)

---

Top Contributors

[![bachwehbi](https://avatars.githubusercontent.com/u/6849883?v=4)](https://github.com/bachwehbi "bachwehbi (18 commits)")

### Embed Badge

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

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

PHPackages © 2026

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