summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJordan Nornhold <nornholdj@gmail.com>2015-09-08 22:24:16 -0400
committerJordan Nornhold <nornholdj@gmail.com>2015-09-08 22:24:16 -0400
commitaeea514f81c652257b64e606c771cc51249db49c (patch)
tree7884f1a4c5b418fda7ef84693f7e1d0aed0b6f0a /examples
parent3fb7f608b1252d1bf973f79af8f98ee11b9f1a0d (diff)
parentc48ff8467d2a4ae229df6a3b8949e82d0d792ee5 (diff)
downloadphp-sparkpost-aeea514f81c652257b64e606c771cc51249db49c.zip
php-sparkpost-aeea514f81c652257b64e606c771cc51249db49c.tar.gz
php-sparkpost-aeea514f81c652257b64e606c771cc51249db49c.tar.bz2
Merge pull request #15 from MattApril/master
SDK Refactor for easy extensibility
Diffstat (limited to 'examples')
-rw-r--r--examples/unwrapped/create_template.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/examples/unwrapped/create_template.php b/examples/unwrapped/create_template.php
new file mode 100644
index 0000000..717430f
--- /dev/null
+++ b/examples/unwrapped/create_template.php
@@ -0,0 +1,25 @@
+<?php
+namespace Examples\Unwrapped;
+require_once (dirname(__FILE__).'/../bootstrap.php');
+use SparkPost\SparkPost;
+use SparkPost\APIResource;
+
+$key = 'YOURAPIKEY';
+SparkPost::setConfig(array('key'=>$key));
+
+try {
+ // define the endpoint
+ APIResource::$endpoint = 'templates';
+
+ $templateConfig = array(
+ '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);
+ echo 'Congrats you can use your SDK!';
+} catch (\Exception $exception) {
+ echo $exception->getMessage();
+}
+?> \ No newline at end of file