summaryrefslogtreecommitdiffstats
path: root/examples/unwrapped/create_template.php
diff options
context:
space:
mode:
Diffstat (limited to 'examples/unwrapped/create_template.php')
-rw-r--r--examples/unwrapped/create_template.php11
1 files changed, 4 insertions, 7 deletions
diff --git a/examples/unwrapped/create_template.php b/examples/unwrapped/create_template.php
index ee4ff6c..b092340 100644
--- a/examples/unwrapped/create_template.php
+++ b/examples/unwrapped/create_template.php
@@ -1,30 +1,27 @@
<?php
namespace Examples\Unwrapped;
require_once (dirname(__FILE__).'/../bootstrap.php');
-use SparkPost\SparkPost;
-use SparkPost\APIResource;
use GuzzleHttp\Client;
use Ivory\HttpAdapter\Guzzle6HttpAdapter;
$key = 'YOUR API KEY';
$httpAdapter = new Guzzle6HttpAdapter(new Client());
-SparkPost::configure($httpAdapter, ['key'=>$key]);
+$resource = new \SparkPost\APIResource($httpAdapter, ['key'=>$key]);
try {
// define the endpoint
- APIResource::$endpoint = 'templates';
+ $resource->endpoint = 'templates';
$templateConfig = [
'name' => 'Summer Sale!',
'id'=>'summer-sale',
'content'=> [
- 'from' => 'john.doe@sparkpostbox.com',
+ 'from' => 'from@sparkpostbox.com',
'subject' => 'Summer deals',
'html' => '<b>Check out these deals!</b>'
]
];
- $results = APIResource::create($templateConfig);
- var_dump($results);
+ $results = $resource->create($templateConfig);
echo 'Congrats you can use your SDK!';
} catch (\Exception $exception) {
echo $exception->getMessage();