summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authormapril <mapril@thebettersoftwarecompany.com>2015-08-21 16:09:40 -0400
committermapril <mapril@thebettersoftwarecompany.com>2015-08-21 16:09:40 -0400
commitd1edaca057512c55adfc7db7a50e2fc8ed064642 (patch)
tree7def560c53f8b1fe6b3a176fd517f81fa6379cb1 /examples
parent893adeac25052274356b7ffac5f14f12bb346877 (diff)
downloadphp-sparkpost-d1edaca057512c55adfc7db7a50e2fc8ed064642.zip
php-sparkpost-d1edaca057512c55adfc7db7a50e2fc8ed064642.tar.gz
php-sparkpost-d1edaca057512c55adfc7db7a50e2fc8ed064642.tar.bz2
added base object, test and example
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