Created
June 9, 2015 23:38
-
-
Save trq/dd27405150df444f4328 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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