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

ActiveLibrary[API Development](/categories/api)

bandwidth/sdk
=============

Bandwidth's set of APIs

v13.0.0(4mo ago)16948.8k↓29.1%10[1 issues](https://github.com/Bandwidth/php-sdk/issues)[1 PRs](https://github.com/Bandwidth/php-sdk/pulls)1MITPHPPHP &gt;=8.0.0CI failing

Since Oct 1Pushed 1mo ago35 watchersCompare

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

READMEChangelog (10)Dependencies (3)Versions (60)Used By (1)

Bandwidth PHP SDK
=================

[](#bandwidth-php-sdk)

[![Test](https://github.com/Bandwidth/php-sdk/actions/workflows/test.yml/badge.svg)](https://github.com/Bandwidth/php-sdk/actions/workflows/test.yml)

**OS****PHP**Windows 20228.0, 8.1, 8.2, 8.3, 8.4Windows 20258.0, 8.1, 8.2, 8.3, 8.4Ubuntu 22.048.0, 8.1, 8.2, 8.3, 8.4Ubuntu 24.048.0, 8.1, 8.2, 8.3, 8.4Getting Started
---------------

[](#getting-started)

### Installation

[](#installation)

```
composer require bandwidth/sdk

```

### Initialize

[](#initialize)

```
require "vendor/autoload.php";

$config = new BandwidthLib\Configuration(
    array(
        'messagingBasicAuthUserName' => 'username',
        'messagingBasicAuthPassword' => 'password',
        'voiceBasicAuthUserName' => 'username',
        'voiceBasicAuthPassword' => 'password',
        'twoFactorAuthBasicAuthUserName' => 'username',
        'twoFactorAuthBasicAuthPassword' => 'password',
        'webRtcBasicAuthUserName' => 'username',
        'webRtcBasicAuthPassword' => 'password'
    )
);
$client = new BandwidthLib\BandwidthClient($config);
$accountId = "12345";
```

### Create A Phone Call

[](#create-a-phone-call)

```
$voiceClient = $client->getVoice()->getClient();

$body = new BandwidthLib\Voice\Models\CreateCallRequest();
$body->from = "+15554443333";
$body->to = "+15554442222";
$body->answerUrl = "https://test.com";
$body->applicationId = "3-d-4-b-5";

try {
    $response = $voiceClient->createCall($voiceAccountId, $body);
    print_r($response);
} catch (Exception $e) {
    print_r($e);
}
```

### Send A Text Message

[](#send-a-text-message)

```
$messagingClient = $client->getMessaging()->getClient();

$body = new BandwidthLib\Messaging\Models\MessageRequest();
$body->from = "+12345678901";
$body->to = array("+12345678902");
$body->applicationId = "1234-ce-4567-de";
$body->text = "Greetings!";

try {
    $response = $messagingClient->createMessage($messagingAccountId, $body);
    print_r($response);
} catch (Exception $e) {
    print_r($e);
}
```

### Create BXML

[](#create-bxml)

```
$speakSentence = BandwidthLib\Voice\Bxml\SpeakSentence::make("Hello!")
    ->voice("susan")
    ->locale("en_US")
    ->gender("female");
$response = BandwidthLib\Voice\Bxml\Response::make()
    ->addVerb($speakSentence);
echo $response->toBxml();
```

### Create A MFA Request

[](#create-a-mfa-request)

```
$mfaClient = $client->getTwoFactorAuth()->getMFA();

$body = new BandwidthLib\TwoFactorAuth\Models\TwoFactorCodeRequestSchema();
$body->from = "+15554443333";
$body->to = "+15553334444";
$body->applicationId = "3-a-b-d";
$body->scope = "scope";
$body->digits = 6;
$body->message = "Your temporary {NAME} {SCOPE} code is {CODE}";
$mfaClient->createVoiceTwoFactor($accountId, $body);

$body = new BandwidthLib\TwoFactorAuth\Models\TwoFactorVerifyRequestSchema();
$body->from = "+15554443333";
$body->to = "+15553334444";
$body->applicationId = "3-a-b-d";
$body->scope = "scope";
$body->code = "123456";
$body->digits = 6;
$body->expirationTimeInMinutes = 3;

$response = $mfaClient->createVerifyTwoFactor($accountId, $body);
echo $response->getResult()->valid;
```

### WebRtc Participant &amp; Session Management

[](#webrtc-participant--session-management)

```
$webRtcClient = $client->getWebRtc()->getClient();

$createSessionBody = new BandwidthLib\WebRtc\Models\Session();
$createSessionBody->tag = 'new-session';

$createSessionResponse = $webRtcClient->createSession($accountId, $createSessionBody);
$sessionId = $createSessionResponse->getResult()->id;

$createParticipantBody = new BandwidthLib\WebRtc\Models\Participant();
$createParticipantBody->callbackUrl = 'https://sample.com';
$createParticipantBody->publishPermissions = array(
    BandwidthLib\WebRtc\Models\PublishPermissionEnum::AUDIO,
    BandwidthLib\WebRtc\Models\PublishPermissionEnum::VIDEO
);

$body = new BandwidthLib\WebRtc\Models\Subscriptions();
$body->sessionId = "1234-abcd";

$createParticipantResponse = $webRtcClient->createParticipant($accountId, $createParticipantBody);
$participantId = $createParticipantResponse->getResult()->participant->id;

$webRtcClient->addParticipantToSession($accountId, $sessionId, $participantId, $body);
```

Supported PHP Versions
----------------------

[](#supported-php-versions)

This package can be used with PHP &gt;= 7.2

Documentation
-------------

[](#documentation)

Documentation for this package can be found at

Credentials
-----------

[](#credentials)

Information for credentials for this package can be found at

###  Health Score

63

—

FairBetter than 99% of packages

Maintenance83

Actively maintained with recent releases

Popularity49

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor3

3 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 ~40 days

Recently: every ~140 days

Total

57

Last Release

132d ago

Major Versions

v8.2.0 → v9.0.02022-04-25

v9.1.0 → v10.0.02022-06-27

v10.6.1 → v11.0.02024-07-09

v11.0.1 → v12.0.02025-11-21

v12.0.0 → v13.0.02026-01-06

PHP version history (3 changes)v0.0.10PHP &gt;=5.4.0

v9.0.0PHP &gt;=7.2.0

v13.0.0PHP &gt;=8.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/dcb348547ff8f4704d77b280ed559903a463e9254e9934cf6bc2c167bdd5d093?d=identicon)[DX-Bandwidth](/maintainers/DX-Bandwidth)

---

Top Contributors

[![brianluisgomez](https://avatars.githubusercontent.com/u/3445445?v=4)](https://github.com/brianluisgomez "brianluisgomez (46 commits)")[![ajrice6713](https://avatars.githubusercontent.com/u/53190766?v=4)](https://github.com/ajrice6713 "ajrice6713 (44 commits)")[![jmulford-bw](https://avatars.githubusercontent.com/u/39915377?v=4)](https://github.com/jmulford-bw "jmulford-bw (29 commits)")[![ckoegel](https://avatars.githubusercontent.com/u/53310569?v=4)](https://github.com/ckoegel "ckoegel (17 commits)")[![DX-Bandwidth](https://avatars.githubusercontent.com/u/42817071?v=4)](https://github.com/DX-Bandwidth "DX-Bandwidth (17 commits)")[![mhamer-bw](https://avatars.githubusercontent.com/u/236859667?v=4)](https://github.com/mhamer-bw "mhamer-bw (9 commits)")[![jgutierrezglez](https://avatars.githubusercontent.com/u/83696425?v=4)](https://github.com/jgutierrezglez "jgutierrezglez (9 commits)")[![acopeland-bw](https://avatars.githubusercontent.com/u/55557158?v=4)](https://github.com/acopeland-bw "acopeland-bw (5 commits)")[![mmcdonald-bw](https://avatars.githubusercontent.com/u/91916589?v=4)](https://github.com/mmcdonald-bw "mmcdonald-bw (2 commits)")[![hamermike](https://avatars.githubusercontent.com/u/1902544?v=4)](https://github.com/hamermike "hamermike (1 commits)")[![gustavochavarria](https://avatars.githubusercontent.com/u/37227357?v=4)](https://github.com/gustavochavarria "gustavochavarria (1 commits)")[![bw-mot](https://avatars.githubusercontent.com/u/44877922?v=4)](https://github.com/bw-mot "bw-mot (1 commits)")

---

Tags

sdksdlc-enforcedapisdkbandwidth

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[messagemedia/messages-sdk

The MessageMedia Messages API provides a number of endpoints for building powerful two-way messaging applications.

13390.6k](/packages/messagemedia-messages-sdk)

PHPackages © 2026

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