Skip to content

Instantly share code, notes, and snippets.

@orobogenius
Created February 20, 2019 20:35
Show Gist options
  • Save orobogenius/596809b9737a117feb3f0cd42f6b0087 to your computer and use it in GitHub Desktop.
Save orobogenius/596809b9737a117feb3f0cd42f6b0087 to your computer and use it in GitHub Desktop.
<?php
namespace App\Components\Sms\Drivers;
use Nexmo\Client as NexmoClient;
class NexmoDriver extends Driver
{
/**
* The Nexmo client.
*
* @var \Nexmo\Client
*/
protected $client;
/**
* The phone number this sms should be sent from.
*
* @var string
*/
protected $from;
/**
* Create a new Nexmo driver instance.
*
* @param \Nexmo\Client $nexmo
* @param string $from
* @return void
*/
public function __construct(NexmoClient $nexmo, $from)
{
$this->client = $nexmo;
$this->from = $from;
}
/**
* {@inheritdoc}
*/
public function send()
{
return $this->client->message()->send([
'type' => 'text',
'from' => $this->from,
'to' => $this->recipient,
'text' => trim($this->message)
]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment