diff options
Diffstat (limited to 'examples/unwrapped/create_template.php')
-rw-r--r-- | examples/unwrapped/create_template.php | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/examples/unwrapped/create_template.php b/examples/unwrapped/create_template.php index 717430f..ee4ff6c 100644 --- a/examples/unwrapped/create_template.php +++ b/examples/unwrapped/create_template.php @@ -3,23 +3,30 @@ namespace Examples\Unwrapped; require_once (dirname(__FILE__).'/../bootstrap.php'); use SparkPost\SparkPost; use SparkPost\APIResource; +use GuzzleHttp\Client; +use Ivory\HttpAdapter\Guzzle6HttpAdapter; -$key = 'YOURAPIKEY'; -SparkPost::setConfig(array('key'=>$key)); +$key = 'YOUR API KEY'; +$httpAdapter = new Guzzle6HttpAdapter(new Client()); +SparkPost::configure($httpAdapter, ['key'=>$key]); try { // define the endpoint APIResource::$endpoint = 'templates'; - - $templateConfig = array( + + $templateConfig = [ 'name' => 'Summer Sale!', - 'content.from' => 'marketing@bounces.company.example', - 'content.subject' => 'Summer deals', - 'content.html' => '<b>Check out these deals!</b>', - ); - $results = APIResource::sendRequest($templateConfig); + 'id'=>'summer-sale', + 'content'=> [ + 'from' => 'john.doe@sparkpostbox.com', + 'subject' => 'Summer deals', + 'html' => '<b>Check out these deals!</b>' + ] + ]; + $results = APIResource::create($templateConfig); + var_dump($results); echo 'Congrats you can use your SDK!'; } catch (\Exception $exception) { echo $exception->getMessage(); } -?>
\ No newline at end of file +?> |