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

ActiveLibrary

selivery/enterprise-sdk-php
===========================

Official PHP SDK for Selivery Enterprise API

v2.0.0(1mo ago)02↓100%MITPHPPHP ^8.2

Since Mar 5Pushed 1mo agoCompare

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

READMEChangelogDependencies (6)Versions (3)Used By (0)

Selivery Enterprise PHP SDK
===========================

[](#selivery-enterprise-php-sdk)

Official PHP SDK for the Selivery Enterprise API.

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

[](#installation)

- Require via Composer: `composer require selivery/enterprise-sdk-php`
- Requires PHP ^8.2 with `ext-openssl` and `ext-json`.

Usage
-----

[](#usage)

### Method: send

[](#method-send)

`send(...)` automatically:

- looks up the phone's public key,
- generates a crypto‑random vector (default 32 chars),
- encrypts each secret value using RSA PKCS#1 v1.5 (`openssl_public_encrypt`) with that vector, and
- includes the resolved `key_uuid` and the generated `vector` in the request.

No sender parameter is needed (it is derived from the template on the service).

```
use Selivery\Enterprise\EnterpriseClient;

$client = new EnterpriseClient(getenv('SELIVERY_SECRET') ?: '');

/** @var Selivery\Enterprise\Models\SendResult $response */
$response = $client->send(
    phone: '+12025550123',
    idTemplate: 1,
    // Vector is generated automatically and used for encryption and request body
    secrets: [
        ['placeholder' => 'code', 'values' => '123456'],
    ]
);
```

### Method: sendLight

[](#method-sendlight)

Difference from send:

- send encrypts values locally in the SDK and sends only encrypted chunks to Selivery. This means even Selivery (or any intermediary) cannot read your values.
- sendLight accepts plaintext values; Selivery encrypts them as the very first step on the server and then handles only encrypted values afterward. Both methods are secure; send offers an even stricter privacy boundary since plaintext never leaves your process.

```
/** @var Selivery\Enterprise\Models\SendResult $response */
$response = $client->sendLight(
    phone: '+12025550123',
    idTemplate: 1,
    secrets: [
        ['key' => 'code', 'values' => '123456'],
    ]
);
```

### Token caching (PSR-16)

[](#token-caching-psr-16)

Inject any PSR-16 cache to enable automatic caching and refresh of OAuth tokens.

```
use Selivery\Enterprise\EnterpriseClient;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Psr16Cache;

$pool = new FilesystemAdapter(namespace: 'selivery', defaultLifetime: 0);
$psr16 = new Psr16Cache($pool);

// Options (optional):
// - base_url: override API base URL
// - timeout: request timeout in seconds
// - cache_key: override default key (default: selivery_enterprise_sdk_tokens:{sha1(baseUrl)})
// - token_safety_window: seconds before expiry to refresh (default: 60)

$client = new EnterpriseClient(
    secret: getenv('SELIVERY_SECRET') ?: '',
    cache: $psr16,
    options: [
        'token_safety_window' => 60,
        // 'cache_key' => 'custom_key_per_env',
    ]
);

// The SDK generates tokens automatically on the first request,
// then reuses and refreshes them through the cache.
```

Examples
--------

[](#examples)

- Send message: `SELIVERY_SECRET=your-secret php examples/service_send.php`
- Send light message: `SELIVERY_SECRET=your-secret php examples/service_send_light.php`

Notes
-----

[](#notes)

- `EnterpriseClient` is the only public entry point. Call `send(...)` or `sendLight(...)` on it directly.
- The SDK uses your secret only for `generate-token`.
- Service requests use the generated `access_token` automatically.
- If a cache is provided, the SDK stores both access and refresh tokens and refreshes the access token when needed.
- POST endpoints accept JSON bodies; include `Content-Type: application/json`.
- The `sender` field has been removed from SDK methods and requests; it is derived from the template server‑side.
- Token cache key default: `selivery_enterprise_sdk_tokens:{sha1(baseUrl)}`. Avoid putting secrets in cache keys.
- Safety window default: 60s. Treats token as expired when `now >= expires_at - safety_window`.

### PSR-16 implementations

[](#psr-16-implementations)

- Symfony Cache: `Psr16Cache` over `FilesystemAdapter` (disk) or `RedisAdapter` (Redis).
- Any PSR-16 provider is supported: pass your `Psr\SimpleCache\CacheInterface` to `EnterpriseClient`.

See examples:

- Symfony filesystem cache: `php examples/cache_symfony.php`
- Symfony Redis cache: `php examples/cache_redis_symfony.php`

###  Health Score

40

—

FairBetter than 87% of packages

Maintenance97

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% 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 ~16 days

Total

2

Last Release

48d ago

Major Versions

v1.0.0 → v2.0.02026-03-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/06a49ebdcd020d698014c779f96e3fe910b3f41f22a044de2cf406f4e4d9e9cc?d=identicon)[seliverycom](/maintainers/seliverycom)

---

Top Contributors

[![narekmarkosyan](https://avatars.githubusercontent.com/u/2436875?v=4)](https://github.com/narekmarkosyan "narekmarkosyan (4 commits)")[![seliverycom](https://avatars.githubusercontent.com/u/155722431?v=4)](https://github.com/seliverycom "seliverycom (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.6k509.9M16.9k](/packages/laravel-framework)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k17](/packages/civicrm-civicrm-core)[nutgram/nutgram

The Telegram bot library that doesn't drive you nuts

714214.9k8](/packages/nutgram-nutgram)[guanguans/notify

Push notification SDK(AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

682104.9k7](/packages/guanguans-notify)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M385](/packages/shopware-core)

PHPackages © 2026

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