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

ActiveLibrary[API Development](/categories/api)

bluerocktel/php-sdk
===================

The Official BlueRockTEL API PHP Client/SDK

v1.3.0(1mo ago)0260↓50%MITPHPPHP ^8.2

Since Aug 4Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/bluerocktel/php-sdk)[ Packagist](https://packagist.org/packages/bluerocktel/php-sdk)[ RSS](/packages/bluerocktel-php-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (11)Versions (15)Used By (0)

php-sdk
=======

[](#php-sdk)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Latest Version on Packagist](https://camo.githubusercontent.com/aaaa3b94a21496d00cda6f3e9b64a48bdda5405a9c836a5c20e6e51ea4ac7a65/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626c7565726f636b74656c2f7068702d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bluerocktel/php-sdk)[![Total Downloads](https://camo.githubusercontent.com/eb4885c6f62462cf50807ce69624f627fbaa05f6d76a9065ebc68b5946cf80cd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f626c7565726f636b74656c2f7068702d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bluerocktel/php-sdk)

This package is a light PHP Wrapper / SDK for the [BlueRockTEL](https://bluerocktel.com) Admin API.

- [Installation](#installation)
- [Authentication](#authentication)
    - [Client Code Grant](#authentication-client-code-grant)
    - [Password Grant](#authentication-password-grant)
- [Usage](#usage)
    - [Requests](#usage-requests)
    - [Resources](#usage-resources)
    - [Responses](#usage-responses)
    - [Entities](#usage-entities)
    - [Pagination](#usage-pagination)
    - [Extending the SDK](#usage-extends)

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

[](#installation)

This library requires PHP `>=8.1`.

You can install the package via composer:

```
composer require bluerocktel/php-sdk

```

Authentication
--------------

[](#authentication)

BlueRockTEL APIs supports OAuth2 for authentication. However, this package currently only supports the Password Grant authentication flow.

### Client Code Grant

[](#client-code-grant)

Not supported yet.

### Password Grant

[](#password-grant)

To connect using your usual BlueRockTEL credentials, first initiate the `BlueRockTELConnector` class providing your instance URL, email and password :

```
use BlueRockTEL\SDK\BlueRockTELConnector;

$api = new BlueRockTELConnector(
  'https://telecomxxxx-admin.bluerocktel.net/api/',
  'developers@bluerocktel.com',
  'secret',
);
```

If the connector fails to retrive a Bearer token from the provided credentials, a `BlueRockTEL\SDK\Exceptions\AuthenticationException` will be thrown.

Otherwise, you can start testing the API by calling the `version()` method of Helper resource :

```
$response = $api->helper()->version();

var_dump(
  $response->failed(), // true is the request returned 4xx or 5xx code.
  $response->json(),   // json response as an array
);
```

Usage
-----

[](#usage)

To query the API, you can either call each API [Endpoints requests](https://github.com/bluerocktel/php-sdk/tree/main/src/Endpoints) individually, or make use of provided [Resources classes](https://github.com/bluerocktel/php-sdk/tree/main/src/Resources) which groups the requests into clusters.

### Using Requests

[](#using-requests)

Using single requests is pretty straightforward. You can use the `call()` method of the `BlueRockTELConnector` class to send the desired request to the instance :

```
use BlueRockTEL\SDK\BlueRockTELConnector;
use BlueRockTEL\SDK\Endpoints;

$api = new BlueRockTELConnector(BLUEROCKTEL_API_URL, BLUEROCKTEL_API_USERNAME, BLUEROCKTEL_API_PASSWORD);

$response = $api->call(
  new Endpoints\GetVersionRequest()
);

$response = $api->call(
  new Endpoints\Prospects\GetProspectRequest(id: $prospectId)
);
```

### Using Resources

[](#using-resources)

Using resources is a more convenient way to query the API. Each Resource class groups requests by specific API namespaces (Customer, Prospect...).

```
use BlueRockTEL\SDK\BlueRockTELConnector;

$api = new BlueRockTELConnector(BLUEROCKTEL_API_URL, BLUEROCKTEL_API_USERNAME, BLUEROCKTEL_API_PASSWORD);

$query = [
    'filter' => [
        'name' => 'Acme Enterprise',
        'term_match' => 'PR0001'
    ],
    'sort' => '-created_at',
];

$response = $api->prospect()->index(
    query: $query,
    perPage: 20,
    page: 1,
);
```

Resources classes usually provide (but are not limited to) the following methods :

```
class NamespaceResource
{
    public function index(array $params = [], int $perPage = 20, int $page = 1): Response;
    public function show(int $id): Response;
    public function store(Entity $entity): Response;
    public function update(Entity $entity): Response;
    public function upsert(Entity $entity): Response;
    public function delete(int $id): Response;
}
```

> 👉 The `upsert()` method is a simple alias : it will call the `update()` method if the given entity has an id, or the `store()` method if not.

Each of those namespace resources can be accessed using the `BlueRockTELConnector` instance :

```
$connector = new BlueRockTELConnector(...);

$connector->note(): Resources\NoteResource
$connector->prospect(): Resources\ProspectResource
$connector->customerFile(): Resources\CustomerFileResource
...
```

If needed, it is also possible to create the desired resource instance manually.

```
use BlueRockTEL\SDK\BlueRockTELConnector;
use BlueRockTEL\SDK\Resources\ProspectResource;

$api = new BlueRockTELConnector();
$resource = new ProspectResource($api);

$prospect = $resource->show($prospectId);
$resource->upsert($prospect);
```

### Responses

[](#responses)

Weither you are using Requests or Resources, the response is always an instance of `Saloon\Http\Response` class. It provides some useful methods to check the response status and get the response data.

```
// Check response status
$response->ok();
$response->failed();
$response->status();
$response->headers();

// Get response data
$response->json(); # as an array
$response->body(); # as an raw string
$response->dtoOrFail(); # as a Data Transfer Object
```

You can learn more about responses by reading the [Saloon documentation](https://docs.saloon.dev/the-basics/responses#useful-methods), which this SDK uses underneath.

### Entities (DTO)

[](#entities-dto)

When working with APIs, dealing with a raw or JSON response can be tedious and unpredictable.

To make it easier, this SDK provides a way to transform the response data into a Data Transfer Object (DTO) (later called Entities). This way, you are aware of the structure of the data you are working with, and you can access the data using object typed properties instead of untyped array keys.

```
$response = $api->prospect()->show(id: 92);

/** @var \BlueRockTEL\SDK\Entities\Prospect */
$prospect = $response->dtoOrFail();
```

Although you can use the `dto()` method to transform the response data into an entity, it is recommended to use the `dtoOrFail()` method instead. This method will throw an exception if the response status is not 2xx, instead of returning an empty DTO.

It is still possible to access the underlying response object using the `getResponse()` method of the DTO :

```
$entity = $response->dtoOrFail();   // \BlueRockTEL\SDK\Contracts\Entity
$entity->getResponse();             // \Saloon\Http\Response
```

> Learn more about working with Data tranfert objects on the [Saloon documentation](https://docs.saloon.dev/digging-deeper/data-transfer-objects).

The create/update/upsert routes will often ask for a DTO as first parameter :

```
use BlueRockTEL\SDK\Entities\Prospect;

// create
$response = $api->prospect()->store(
    prospect: new Prospect(
        name: 'Acme Enterprise',
        customerAccount: 'PR0001',
    ),
);

$prospect = $response->dtoOrFail();

// update
$prospect->name = 'Acme Enterprise Inc.';
$api->prospect()->update($prospect);
```

### Pagination

[](#pagination)

On some index/search routes, the BlueRockTEL API will use a pagination. If you need to iterate on all pages of the endpoint, you may find handy to use the connector's `paginate()` method :

```
$query = [
  'sort' => 'created_at',
];

# Create a PagedPaginator instance
$paginator = $api->paginate(new GetProspectsRequest($query));

# Iterate on all pages entities, using lazy loading for performance
foreach ($paginator->items() as $prospect) {
    $name = $prospect->name;
    $customerAccount = $prospect->customerAccount;
}
```

Read more about lazy paginations on the [Saloon documentation](https://docs.saloon.dev/installable-plugins/pagination#using-the-paginator).

### Extending the SDK

[](#extending-the-sdk)

You may easily extend the SDK by creating your own Resources, Requests, and Entities.

Then, by extending the `BlueRockTELConnector` class, add you new resources to the connector :

```
use BlueRockTEL\SDK\BlueRockTELConnector;

class MyCustomConnector extends BlueRockTELConnector
{
    public function defaultConfig(): array
    {
        return [
            'timeout' => 120,
        ];
    }

    public function customResource(): \App\Resources\CustomResource
    {
        return new \App\Resources\CustomResource($this);
    }
}

$api = new MyCustomConnector(BLUEROCKTEL_API_URL, BLUEROCKTEL_API_USERNAME, BLUEROCKTEL_API_PASSWORD);
$api->customResource()->index();
```

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance89

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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

Every ~80 days

Recently: every ~64 days

Total

13

Last Release

54d ago

Major Versions

v0.3.0 → v1.0.0-beta2024-04-03

PHP version history (3 changes)v0.3.0PHP &gt;=8.0

v1.0.0-betaPHP &gt;=8.1

v1.2.0PHP ^8.2

### Community

Maintainers

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

---

Top Contributors

[![tgeorgel](https://avatars.githubusercontent.com/u/11785727?v=4)](https://github.com/tgeorgel "tgeorgel (26 commits)")

---

Tags

bluerockteltelecom

### Embed Badge

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

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

###  Alternatives

[sandorian/moneybird-api-php

Moneybird API client for PHP

127.3k](/packages/sandorian-moneybird-api-php)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1221.1k](/packages/codebar-ag-laravel-docuware)[myoutdeskllc/salesforce-php

salesforce library for php8+

1560.8k](/packages/myoutdeskllc-salesforce-php)

PHPackages © 2026

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