summaryrefslogtreecommitdiffstats
path: root/examples/unwrapped
diff options
context:
space:
mode:
authorbeardyman <nornholdj@gmail.com>2015-09-17 23:20:26 -0400
committerbeardyman <nornholdj@gmail.com>2015-09-17 23:20:26 -0400
commitefe48cc85e619768f69cd1d4843505bf9d146745 (patch)
tree9d0f5c7bae4a4d75745d30d969798a9c121155fd /examples/unwrapped
parentb51ce2d0a8fad2577c164e1ab1c8382b1ae23fae (diff)
downloadphp-sparkpost-efe48cc85e619768f69cd1d4843505bf9d146745.zip
php-sparkpost-efe48cc85e619768f69cd1d4843505bf9d146745.tar.gz
php-sparkpost-efe48cc85e619768f69cd1d4843505bf9d146745.tar.bz2
Removed most static methods and adopted an instance based implementation. Updated all examples and compatibility later to reflect these changes.
Diffstat (limited to 'examples/unwrapped')
-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();