PHPackages                             onecommunity/client - 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. [API Development](/categories/api)
4. /
5. onecommunity/client

ActiveLibrary[API Development](/categories/api)

onecommunity/client
===================

PHP client to access the One Community API.

v0.10.0(5y ago)23.5k1MITPHPPHP ^7.2|^8.0

Since May 30Pushed 3y ago2 watchersCompare

[ Source](https://github.com/emolifeconnect/onecommunity-php)[ Packagist](https://packagist.org/packages/onecommunity/client)[ Docs](https://github.com/emolifeconnect/onecommunity-php)[ RSS](/packages/onecommunity-client/feed)WikiDiscussions master Synced 3w ago

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

One Community
=============

[](#one-community)

An easy-to-use PHP client to access the [One Community](https://www.onecommunity.nl/) API.

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

[](#installation)

Using [Composer](https://getcomposer.org/):

`composer require onecommunity/client`

Contact us with your [public key](#generating-the-publicprivate-key-pair) to receive your API key.

Usage
-----

[](#usage)

### Initializing the Client

[](#initializing-the-client)

```
use OneCommunity\Client;

$apiKey = "xxxxxxx";
$projectName = "yourproject";
$userId = 1;

$client = new Client($apiKey, $userId, $projectName);

// Load private key from file..
$client->loadPrivateKey("private_rsa.pem");
// ..or string
$client->setPrivateKey($privateKey);
```

### Sending Requests

[](#sending-requests)

See the [Examples](https://github.com/emolifeconnect/onecommunity-php/tree/master/examples) directory for working examples.

#### UserRequest

[](#userrequest)

Returns the `User` object of the authenticated user. Great for testing.

```
use OneCommunity\Requests\UserRequest;

$request = new UserRequest;
$response = $client->send($request);

if ($response->isSuccessful()) {
    var_dump($response->getData());
}
```

#### SendTransactionalMailRequest

[](#sendtransactionalmailrequest)

```
use OneCommunity\Requests\SendTransactionalMailRequest;

$accountId = 1; // Recipient
$transactionalMailId = 1; // Mail

$request = new SendTransactionalMailRequest($accountId, $transactionalMailId);
$request->setSubstitutions(['gift' => 'Free coffee ☕']);

$response = $client->send($request);
```

### Responses

[](#responses)

The following HTTP status codes are used:

HTTP Status CodeDescription200 OKEverything is OK, the body contains the payload.400 Bad RequestIndicates an authentication error.404 Not FoundSome ID refers to an unknown model (e.g., unknown account or mail).422 Unprocessable EntityValidation errors.429 Too Many RequestsYou cannot send more than 60 requests per minute.If anything unexpected occurs a `OneCommunity\Exceptions\RequestException` is thrown (e.g., if the API does not return a valid JSON response).

All responses (except `200 OK`) contain a `message` attribute, explaining what went wrong. Furthermore, `400 Bad Requests` responses contain a `code` attribute which can contain one of the following values:

codemessage100Invalid API key101Could not decode Bearer token102No API key found on request103No Bearer token found on request104Token could not be verified201Client not found202User not found or not accessible by this API Client501No access to this project or invalid project502No access from this IPThe validation errors of a `422 Unprocessable Entity` response are structured as follows:

```
{
    "errors": {
        "field1": [
            "error1",
            "error2"
        ],
        "field2": [
            "error3"
        ]
    }
}
```

Security
--------

[](#security)

The API is based on [JWT API](https://github.com/jarnovanleeuwen/jwtapi), an efficient and secure machine-to-machine API using JSON Web Tokens and asymmetric request signing. Advantages of this approach include:

- Requests and responses are sent over a secure channel.
- Requests can only be signed by the API consumer (providing non-repudiation).
- Requests are only valid for a short time (avoiding replay attacks).

Due to the asymmetric nature of this protocol, a public/private key pair needs to be generated (RSA 2048 bit). The key pair can be generated by issuing the following commands. Please send your public key (`public_rsa.pem`) to us and keep your private key safe.

### Generating the Public/Private Key Pair

[](#generating-the-publicprivate-key-pair)

```
# Generates RSA private key of 2048 bit size
openssl genrsa -out private_rsa.pem 2048

# Generates public key from the private key
openssl rsa -in private_rsa.pem -outform PEM -pubout -out public_rsa.pem
```

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

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

Every ~94 days

Recently: every ~181 days

Total

11

Last Release

2003d ago

PHP version history (2 changes)v0.2.0PHP ^7.1

v0.10.0PHP ^7.2|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/32504d5db68ddfca1b6c6b9d15e629a68a596307bf1badeb86f4b75ab21992ed?d=identicon)[jarnovanleeuwen](/maintainers/jarnovanleeuwen)

---

Top Contributors

[![jarnovanleeuwen](https://avatars.githubusercontent.com/u/1358997?v=4)](https://github.com/jarnovanleeuwen "jarnovanleeuwen (26 commits)")[![joostbaptist](https://avatars.githubusercontent.com/u/8181757?v=4)](https://github.com/joostbaptist "joostbaptist (11 commits)")

---

Tags

apionecommunity

### Embed Badge

![Health badge](/badges/onecommunity-client/health.svg)

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

###  Alternatives

[m165437/laravel-blueprint-docs

API Blueprint Renderer for Laravel

22779.5k](/packages/m165437-laravel-blueprint-docs)

PHPackages © 2026

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