PHPackages                             kingsquare/communibase-connector-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. kingsquare/communibase-connector-php

ActiveLibrary

kingsquare/communibase-connector-php
====================================

This is the Communibase connector for PHP.

2.5.8(6y ago)15.1k3[2 issues](https://github.com/kingsquare/communibase-connector-php/issues)[1 PRs](https://github.com/kingsquare/communibase-connector-php/pulls)MITPHPPHP &gt;=5.5CI failing

Since Feb 26Pushed 6y ago6 watchersCompare

[ Source](https://github.com/kingsquare/communibase-connector-php)[ Packagist](https://packagist.org/packages/kingsquare/communibase-connector-php)[ RSS](/packages/kingsquare-communibase-connector-php/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (2)Versions (28)Used By (0)

[![Communibase](https://camo.githubusercontent.com/10218fabb4ff0a6475ebbc70b00775926f6695e847923abf66b6054344be4c6d/68747470733a2f2f7777772e636f6d6d756e69626173652e6e6c2f696d672f736974654c6f676f2e706e67)](https://www.communibase.nl)

[![Scrutinizer Quality Score](https://camo.githubusercontent.com/e2bf7711ecd7c979788099384f891ccf99769f332575e944814ed68c2c98e69c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b696e677371756172652f636f6d6d756e69626173652d636f6e6e6563746f722d7068702f6261646765732f7175616c6974792d73636f72652e706e673f733d39346561313434613562363361666462346666396239393939316635636138333062613539643337)](https://scrutinizer-ci.com/g/kingsquare/communibase-connector-php/)[![Travis CI](https://camo.githubusercontent.com/7dced8df6e178edeb6e30a99fbf0d8707c2d47124bd8a23b55010f460e6ed473/68747470733a2f2f7472617669732d63692e6f72672f6b696e677371756172652f636f6d6d756e69626173652d636f6e6e6563746f722d7068702e737667)](https://travis-ci.org/kingsquare/communibase-connector-php)[![Latest Stable Version](https://camo.githubusercontent.com/dca5b294a6b58f32afdaec6a3f8e7c9c4466c0961d181c221d6b2e905b6d52a2/68747470733a2f2f706f7365722e707567782e6f72672f6b696e677371756172652f636f6d6d756e69626173652d636f6e6e6563746f722d7068702f762f737461626c652e706e67)](https://packagist.org/packages/kingsquare/communibase-connector-php)[![License](https://camo.githubusercontent.com/4b456c5e20cb0a1682d6839dac74cb213baf20058e87a060dba778d33618885b/68747470733a2f2f706f7365722e707567782e6f72672f6b696e677371756172652f636f6d6d756e69626173652d636f6e6e6563746f722d7068702f6c6963656e73652e706e67)](https://packagist.org/packages/kingsquare/communibase-connector-php)

A general-purpose Communibase client for PHP projects, compatible with composer packaging-projects.

A connector may be constructed to do REST-calls on the Communibase API.

The behaviour of this package should always Mimic the [node-version](https://github.com/kingsquare/communibase-connector-js)

Usage
=====

[](#usage)

The easiest way to install the connector is to use [Composer](https://getcomposer.org/):

```
composer require kingsquare/communibase-connector-php

```

Now you should be able to install the package by updating your composer environment `composer install`
The connector is available and usable as follows:

```
require_once __DIR__ . '/../vendor/autoload.php'; // Autoload files using Composer autoload
use Communibase\Connector;

$cb = new Connector('');
$peopleNamedTim = $cb->search('Person', ['firstName' => 'Tim'], ['limit' => 5]);
print_r($peopleNamedTim);
```

API
---

[](#api)

"entityType" should be the Communibase Entitytype, e.g. "Person", "Invoice", etc. To see all the entity types your API key allows, see the [API docs](https://api.communibase.nl/docs/) and insert your API key there.

"selectors" may be provided [MongoDb style](http://docs.mongodb.org/manual/reference/method/db.collection.find/#db.collection.find) as array-definitions.

"params" is a key value store for e.g. fields, limit, page and/or sort . See [API docs](https://api.communibase.nl/docs/) for more details. In addition to the nodeJS version of this parameter, the fields value may also be an array of fields. This will work more intuitively in PHP environments.

```
$cbc->search($entityType, $selector, $params): entity[];

$cbc->getAll($entityType, $params): entity[];

$cbc->getById($entityType, $id, $params, $version): entity;

$cbc->getByIds($entityType, $ids, $params): entity[];

$cbc->getId($entityType, $selector): string;

$cbc->getIds($entityType, $selector, $params): null|string[];

$cbc->getByRef($ref[, $parent]): entity

$cbc->getTemplate($entityType): array;

$cbc->getHistory($entityType, $id): array;

$cbc->update($entityType, $properties): responseData;

$cbc->destroy($entityType, $id): responseData;

$cbc->generateId(): string - Generate a new, fresh Communibase ID

//Use for Files only to get a string with the binary contents
$cbc->getBinary(id): string;
```

Whenever a function like `getByIds()` or `getByIds()` returns null, the property `cbc->lastError` should be available containing an error message

Entity
------

[](#entity)

An entity is an associative array containing a key/value store of data in Communibase.

E.g.

```
[
  'firstName' => 'Tim',
  'addresses' => [
    [
      'street' => 'Breestraat',
      // ...
    ],
    // ...
  ]
]
```

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

[](#error-handling)

The connector may throw an error when something goes wrong. Default error handling is as follows:

```
try {
  $person = $cbc->getById('Person', '_PERSON_ID_');
} catch (\Communibase\Exception $e) {
  echo $e->getMessage();
}
```

A special type of error handling involves "Validity" errors for posted documents.

```
try {
  $person = $cbc->update('Person', [...]);
} catch (\Communibase\Exception $e) {
  //get an array of errors, per property:
  //  [
  //    [
  //      'field' => '',
  //      'message' => ''
  //    ]
  //  ]
  print_r($e->getErrors());
}
```

### Query Logging

[](#query-logging)

It is also possible to add a query logger to the connector.

#### Stack query data for debug/dev purposes:

[](#stack-query-data-for-debugdev-purposes)

```
$connector->setQueryLogger(new DebugStack());

```

Query data available after run via `$connector->getQueryLogger()->queries`

#### Echo query for debug/dev purposes (handy for cli):

[](#echo-query-for-debugdev-purposes-handy-for-cli)

```
$connector->setQueryLogger(new EchoQueryLogger());

```

Echoes each query to the current output stream.

#### Create own query logging:

[](#create-own-query-logging)

```
$connector->setQueryLogger(new MyOwnQueryLogger());

```

`MyOwnQueryLogger` implements `QueryLogger` and does something with the data.. possible db/api call

Contributions / Bugreports
--------------------------

[](#contributions--bugreports)

If you're using this app and have questions and/or feedback, please file an issue on Github.
Also we welcome new features and code, so please don't hesitate to get that pull request online!

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity68

Established project with proven stability

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

Recently: every ~211 days

Total

25

Last Release

2549d ago

Major Versions

0.4 → 1.02014-02-27

1.1.3 → 2.0.02015-11-09

PHP version history (2 changes)0.4PHP &gt;=5.3

2.0.0PHP &gt;=5.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/11c7a09c75d2f8770e8195931b2084a6a47ace4cfab44d9bacaf23cde7699273?d=identicon)[fruitl00p](/maintainers/fruitl00p)

![](https://www.gravatar.com/avatar/226f92c396b7f1570c531606ff0e1206c1658ff4322c1bde653115d62af9b405?d=identicon)[Reggino](/maintainers/Reggino)

![](https://www.gravatar.com/avatar/4316c5121fea35d4296c843de950bf4eaf035c721ec0f1ac3d0a4ac72959c27e?d=identicon)[mishavantol](/maintainers/mishavantol)

![](https://www.gravatar.com/avatar/e2a79c04f5dcf0515e6df9174ab6991353d5431219fbb5a82093f91b16e14c04?d=identicon)[Aubrey](/maintainers/Aubrey)

---

Top Contributors

[![fruitl00p](https://avatars.githubusercontent.com/u/1492861?v=4)](https://github.com/fruitl00p "fruitl00p (65 commits)")[![AubreyHewes](https://avatars.githubusercontent.com/u/2069584?v=4)](https://github.com/AubreyHewes "AubreyHewes (35 commits)")[![mishavantol](https://avatars.githubusercontent.com/u/2063695?v=4)](https://github.com/mishavantol "mishavantol (15 commits)")[![Reggino](https://avatars.githubusercontent.com/u/174358?v=4)](https://github.com/Reggino "Reggino (14 commits)")[![bwelboren](https://avatars.githubusercontent.com/u/52087548?v=4)](https://github.com/bwelboren "bwelboren (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

communibase-apicommunibase-connectorconnectorphpconnectorcommunibase

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kingsquare-communibase-connector-php/health.svg)

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

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k21](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[bmeme/eventbrite_connector

PHP Library for integration with Eventbrite API v3

151.1k](/packages/bmeme-eventbrite-connector)

PHPackages © 2026

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