PHP code example of vonage / symfony
1. Go to this page and download the library: Download vonage/symfony library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
vonage / symfony example snippets
// config/bundles.php
return [
// ...
Vonage\ClientBundle\VonageClientBundle::class => ['all' => true],
];
namespace App\Controller;
use Vonage\Client;
use Vonage\SMS\Message\SMS;
class MyController
{
/**
* @var Client
*/
protected $client;
public function __construct(Client $client)
{
$this->client = $client;
}
public function myAction(): Response
{
$this->client->sms()->send(
new SMS($toNumber, $vonageNumber, 'This is an SMS!')
);
}
}