Skip to content
2 changes: 1 addition & 1 deletion account/account-balance.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
$client = new \Nexmo\Client($basic);

$response = $client->account()->getBalance();
echo round($response->data['balance'], 2) . " EUR\n";
echo round($response->getBalance(), 2) . " EUR\n";
2 changes: 1 addition & 1 deletion account/configure-account.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
$response = $client->account()->updateConfig([
"sms_callback_url" => SMS_CALLBACK_URL
]);
print_r($response->data);
print_r($response->toArray());
70 changes: 35 additions & 35 deletions applications/create-application.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php

require_once __DIR__ . '/../config.php';
require_once __DIR__ . '/../vendor/autoload.php';
Expand All @@ -7,48 +7,48 @@
$client = new \Nexmo\Client(new \Nexmo\Client\Credentials\Container($basic));

try {
$application = $client->applications()->create(
[
'name' => 'Sample PHP V2 Application',
'capabilities' => [
'voice' => [
'webhooks' => [
'answer_url' => [
'address' => "https://example.com/webhooks/answer",
'http_method' => "GET"
],
'event_url' => [
'address' => "https://example.com/webhooks/event",
'http_method' => "POST"
]
$application = new Nexmo\Application\Application();
$application->fromArray([
'name' => 'Should Work2',
'capabilities' => [
'voice' => [
'webhooks' => [
'answer_url' => [
'address' => "https://example.com/webhooks/answer",
'http_method' => "GET"
],
'event_url' => [
'address' => "https://example.com/webhooks/event",
'http_method' => "POST"
]
],
'messages' => [
'webhooks' => [
'inbound_url' => [
'address' => "https://example.com/webhooks/inbound",
'http_method' => "POST"
],
'status_url' => [
'address' => "https://example.com/webhooks/status",
'http_method' => "POST"
]
]
],
'messages' => [
'webhooks' => [
'inbound_url' => [
'address' => "https://example.com/webhooks/inbound",
'http_method' => "POST"
],
'status_url' => [
'address' => "https://example.com/webhooks/status",
'http_method' => "POST"
]
],
'rtc' => [
'webhooks' => [
'event_url' => [
'address' => "https://example.com/webhooks/rtcevent",
'http_method' => "POST"
]
]
],
'rtc' => [
'webhooks' => [
'event_url' => [
'address' => "https://example.com/webhooks/rtcevent",
'http_method' => "POST"
]
]
]
]
);
]);
$application = $client->applications()->create($application);

echo $application->getId() . PHP_EOL;
echo $application->getName() . PHP_EOL;
} catch (\InvalidArgumentException $e) {
echo $e->getMessage() . PHP_EOL;
}
}
2 changes: 1 addition & 1 deletion applications/get-application.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php

require_once __DIR__ . '/../config.php';
require_once __DIR__ . '/../vendor/autoload.php';
Expand Down
46 changes: 7 additions & 39 deletions applications/update-application.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php

require_once __DIR__ . '/../config.php';
require_once __DIR__ . '/../vendor/autoload.php';
Expand All @@ -7,45 +7,13 @@
$client = new \Nexmo\Client(new \Nexmo\Client\Credentials\Container($basic));

try {
$application = $client->applications()->update([
'name' => 'Sample PHP V2 Application',
'capabilities' => [
'voice' => [
'webhooks' => [
'answer_url' => [
'address' => "https://example.com/webhooks/answer",
'http_method' => "GET"
],
'event_url' => [
'address' => "https://example.com/webhooks/event",
'http_method' => "POST"
]
]
],
'messages' => [
'webhooks' => [
'inbound_url' => [
'address' => "https://example.com/webhooks/inbound",
'http_method' => "POST"
],
'status_url' => [
'address' => "https://example.com/webhooks/status",
'http_method' => "POST"
]
]
],
'rtc' => [
'webhooks' => [
'event_url' => [
'address' => "https://example.com/webhooks/rtcevent",
'http_method' => "POST"
]
]
]
]
],
MESSAGES_APPLICATION_ID
$application = $client->applications()->get(MESSAGES_APPLICATION_ID);
$application->setName('New Name2');
$application->getVoiceConfig()->setWebhook(
Nexmo\Application\VoiceConfig::ANSWER,
new Nexmo\Application\Webhook('http://test.domain/webhook/voice')
);
$application = $client->applications()->update($application);

echo $application->getId() . PHP_EOL;
echo $application->getName() . PHP_EOL;
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"minimum-stability": "RC",
"require": {
"nexmo/client": "^1.6",
"nexmo/client": "v2.2.0-RC1",
"vlucas/phpdotenv": "^2.5"
}
}
Loading