Skip to content

Commit 9de7a04

Browse files
authored
DX-1815 new readme format (#24)
* Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Minor typos
1 parent 3e42a53 commit 9de7a04

File tree

1 file changed

+72
-8
lines changed

1 file changed

+72
-8
lines changed

README.md

Lines changed: 72 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
# Bandwidth PHP SDK
22

3-
Bandwidth's API docs can be found at https://dev.bandwidth.com
3+
## Getting Started
44

5-
PHP specific docs can be found at https://dev.bandwidth.com/sdks/php.html
6-
7-
## Get Started
8-
9-
### Install
5+
### Installation
106

117
```
128
composer require bandwidth/sdk
@@ -19,13 +15,18 @@ require "vendor/autoload.php";
1915
2016
$config = new BandwidthLib\Configuration(
2117
array(
22-
'messagingBasicAuthUserName' => 'token',
23-
'messagingBasicAuthPassword' => 'secret',
18+
'messagingBasicAuthUserName' => 'username',
19+
'messagingBasicAuthPassword' => 'password',
2420
'voiceBasicAuthUserName' => 'username',
2521
'voiceBasicAuthPassword' => 'password',
22+
'twoFactorAuthBasicAuthUserName' => 'username',
23+
'twoFactorAuthBasicAuthPassword' => 'password',
24+
'webRtcBasicAuthUserName' => 'username',
25+
'webRtcBasicAuthPassword' => 'password'
2626
)
2727
);
2828
$client = new BandwidthLib\BandwidthClient($config);
29+
$accountId = "12345";
2930
```
3031

3132
### Create A Phone Call
@@ -77,3 +78,66 @@ $response = new BandwidthLib\Voice\Bxml\Response();
7778
$response->addVerb($speakSentence);
7879
echo $response->toBxml();
7980
```
81+
82+
### Create A MFA Request
83+
84+
```
85+
$mfaClient = $client->getTwoFactorAuth()->getMFA();
86+
87+
$body = new BandwidthLib\TwoFactorAuth\Models\TwoFactorCodeRequestSchema();
88+
$body->from = "+15554443333";
89+
$body->to = "+15553334444";
90+
$body->applicationId = "3-a-b-d";
91+
$body->scope = "scope";
92+
$body->digits = 6;
93+
$body->message = "Your temporary {NAME} {SCOPE} code is {CODE}";
94+
$mfaClient->createVoiceTwoFactor($accountId, $body);
95+
96+
$body = new BandwidthLib\TwoFactorAuth\Models\TwoFactorVerifyRequestSchema();
97+
$body->from = "+15554443333";
98+
$body->to = "+15553334444";
99+
$body->applicationId = "3-a-b-d";
100+
$body->scope = "scope";
101+
$body->code = "123456";
102+
$body->digits = 6;
103+
$body->expirationTimeInMinutes = 3;
104+
105+
$response = $mfaClient->createVerifyTwoFactor($accountId, $body);
106+
echo $response->getResult()->valid;
107+
```
108+
109+
### WebRtc Participant & Session Management
110+
111+
```
112+
$webRtcClient = $client->getWebRtc()->getClient();
113+
114+
$createSessionBody = new BandwidthLib\WebRtc\Models\Session();
115+
$createSessionBody->tag = 'new-session';
116+
117+
$createSessionResponse = $webRtcClient->createSession($accountId, $createSessionBody);
118+
$sessionId = $createSessionResponse->getResult()->id;
119+
120+
$createParticipantBody = new BandwidthLib\WebRtc\Models\Participant();
121+
$createParticipantBody->callbackUrl = 'https://sample.com';
122+
$createParticipantBody->publishPermissions = array(
123+
BandwidthLib\WebRtc\Models\PublishPermissionEnum::AUDIO,
124+
BandwidthLib\WebRtc\Models\PublishPermissionEnum::VIDEO
125+
);
126+
127+
$createParticipantResponse = $webRtcClient->createParticipant($accountId, $createParticipantBody);
128+
$participantId = $createParticipantResponse->getResult()->participant->id;
129+
130+
$webRtcClient->addParticipantToSession($accountId, $sessionId, $participantId);
131+
```
132+
133+
## Supported PHP Versions
134+
135+
This package can be used with PHP >= 5.4
136+
137+
## Documentation
138+
139+
Documentation for this package can be found at https://dev.bandwidth.com/sdks/php.html
140+
141+
## Credentials
142+
143+
Information for credentials for this package can be found at https://dev.bandwidth.com/guides/accountCredentials.html

0 commit comments

Comments
 (0)