PHPackages                             lessotp/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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. lessotp/sdk

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

lessotp/sdk
===========

LessOTP Inbound Phone Authentication client SDK for PHP. WhatsApp and Telegram channels.

v0.2.0(1mo ago)10MITPHPPHP &gt;=7.4

Since Jun 21Pushed 1mo agoCompare

[ Source](https://github.com/lessotp/sdk-php)[ Packagist](https://packagist.org/packages/lessotp/sdk)[ Docs](https://github.com/lessotp/sdk)[ RSS](/packages/lessotp-sdk/feed)WikiDiscussions main Synced 2w ago

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

LessOTP PHP SDK
===============

[](#lessotp-php-sdk)

Client for the **LessOTP Inbound Phone Authentication API** (PHP 7.4+).

Supported channels:

- WhatsApp — inbound `/START {code}` phone verification.
- Telegram — bot `/start {code}` plus the official **Share phone number** button.

Install
-------

[](#install)

```
composer require lessotp/sdk
```

Usage
-----

[](#usage)

```
use LessOTP\Sdk\Client;
use LessOTP\Sdk\VerificationChannel;
use LessOTP\Sdk\VerifyWebhookSignature;

// production (default)
$client = new Client(getenv('LESSOTP_API_KEY'), 'production', 'https://api.lessotp.com');

// staging
$staging = new Client(
    getenv('LESSOTP_STAGING_API_KEY'),
    'staging',
    'https://api.lessotp.com'
);

// WhatsApp strict (legacy-compatible)
$result = $client->authRequest('6281234567890');
echo $result->getChannel()->value(), $result->getWaLink();

// WhatsApp frictionless (legacy-compatible)
$result = $client->authRequest();

// Telegram strict
$result = $client->requestTelegramAuth('6281234567890');
echo $result->getTelegramLink(), PHP_EOL;
echo $result->getTelegramText(), PHP_EOL;

// Telegram frictionless
$result = $client->requestAuth(VerificationChannel::telegram());

// per-call override
$result = $client->requestTelegramAuth('6281234567890', 'staging');

// webhook verification
$raw = file_get_contents('php://input');
$sig = $_SERVER['HTTP_X_SIGNATURE'] ?? '';

if (!VerifyWebhookSignature::hmac($raw, $sig, getenv('LESSOTP_WEBHOOK_SECRET'))) {
    http_response_code(403);
    exit;
}
```

API
---

[](#api)

### `new Client($apiKey, $environment = 'production', $baseUrl = 'https://api.lessotp.com', $timeoutSeconds = 10, $http = null)`

[](#new-clientapikey-environment--production-baseurl--httpsapilessotpcom-timeoutseconds--10-http--null)

Parameters follow the same order as the Go SDK: apiKey → environment → baseUrl → timeout → custom transport.

ParameterDefaultDescription`$apiKey`requiredApp API key.`$environment``'production'``'production'` or `'staging'`.`$baseUrl``https://api.lessotp.com`API host.`$timeoutSeconds``10`HTTP timeout.`$http``null`Optional `GuzzleHttp\Client`.### `$client->authRequest($phoneNumber = null, $environment = null): AuthRequestResult`

[](#client-authrequestphonenumber--null-environment--null-authrequestresult)

Legacy WhatsApp convenience method. The per-call `$environment` overrides the client environment.

### `$client->requestTelegramAuth($phoneNumber = null, $environment = null): AuthRequestResult`

[](#client-requesttelegramauthphonenumber--null-environment--null-authrequestresult)

Telegram short-hand. Strict when `$phoneNumber` is supplied; frictionless when omitted.

### `$client->requestAuth(VerificationChannel $channel, $phoneNumber = null, $environment = null): AuthRequestResult`

[](#client-requestauthverificationchannel-channel-phonenumber--null-environment--null-authrequestresult)

Multi-channel call. Use `VerificationChannel::whatsapp()` or `VerificationChannel::telegram()`.

The normalized result includes:

- `getChannel()` — the resolved channel.
- `getWaLink()` — only when channel is `whatsapp`.
- `getTelegramLink()` / `getTelegramText()` — only when channel is `telegram`.

### `VerificationSuccess::fromArray(array $body): VerificationSuccess`

[](#verificationsuccessfromarrayarray-body-verificationsuccess)

Canonical representation of a `verification.success` webhook payload. Includes `getChannel()` and `getTelegramUserId()` / `getTelegramUsername()` when channel is `telegram`.

### `VerifyWebhookSignature::hmac($rawBody, $signatureHeader, $secret): bool`

[](#verifywebhooksignaturehmacrawbody-signatureheader-secret-bool)

Constant-time HMAC-SHA256 verification. Accepts raw hex and `sha256=` prefixed values.

Errors
------

[](#errors)

Throws `LessOTP\Sdk\LessOTPException` on transport, auth, or payload problems.

Tests
-----

[](#tests)

```
composer install
composer test
```

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance91

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity25

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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

45d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/295308648?v=4)[lessotp](/maintainers/lessotp)[@lessotp](https://github.com/lessotp)

---

Top Contributors

[![fajarbc](https://avatars.githubusercontent.com/u/31872453?v=4)](https://github.com/fajarbc "fajarbc (2 commits)")

---

Tags

AuthenticationtelegramwhatsappverificationPasswordlesslessotp

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k555.0M2.8k](/packages/aws-aws-sdk-php)[google/auth

Google Auth Library for PHP

1.4k302.1M239](/packages/google-auth)[ellaisys/aws-cognito

Laravel Authentication using AWS Cognito (Web and API)

121269.8k1](/packages/ellaisys-aws-cognito)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k832.6k51](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.3M49](/packages/tencentcloud-tencentcloud-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

293.1k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

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