Skip to content

Instantly share code, notes, and snippets.

@trq
Created June 9, 2015 23:38
Show Gist options
  • Save trq/dd27405150df444f4328 to your computer and use it in GitHub Desktop.
Save trq/dd27405150df444f4328 to your computer and use it in GitHub Desktop.
<?php
namespace Foo\SomeBundle\Service;
use Aws\Sns\SnsClient;
class Notifications
{
/**
* @var SnsClient
*/
protected $client;
/**
* @var string
*/
protected $arn;
/**
* @param array $options
* @param string $arn
*
* @return SnsClient
*/
public function __construct($options, $arn)
{
$this->client = SnsClient::factory($options);
$this->arn = $arn;
}
/**
* publish a notification to sns
*
* @param string $subject
* @param string $message
* @return void
*/
public function publish($subject, $message)
{
$this->client->publish([
'TopicArn' => $this->arn,
'Subject' => $subject,
'Message' => $message,
'MessageAttributes' => [
'String' => [
'DataType' => 'String',
'StringValue' => 'string'
]
]
]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment