summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/bootstrap.php4
-rw-r--r--examples/transmission/delete_transmission.php25
-rw-r--r--examples/transmission/get_all_transmissions.php25
-rw-r--r--examples/transmission/get_transmission.php25
-rw-r--r--examples/transmission/rfc822.php34
-rw-r--r--examples/transmission/send_transmission_all_fields.php76
-rw-r--r--examples/transmission/send_with_bcc.php58
-rw-r--r--examples/transmission/send_with_cc.php62
-rw-r--r--examples/transmission/simple_send.php40
-rw-r--r--examples/transmission/stored_recipients_inline_content.php36
-rw-r--r--examples/transmission/stored_template_send.php38
-rw-r--r--examples/transmissions/create_transmission.php46
-rw-r--r--examples/transmissions/create_transmission_with_cc_and_bcc.php62
-rw-r--r--examples/transmissions/delete_transmission.php27
-rw-r--r--examples/transmissions/get_all_transmissions.php27
-rw-r--r--examples/unwrapped/create_template.php35
-rw-r--r--examples/unwrapped/create_transmission.php47
-rw-r--r--examples/unwrapped/get_webhooks.php28
18 files changed, 166 insertions, 529 deletions
diff --git a/examples/bootstrap.php b/examples/bootstrap.php
index 688d53e..1110ed3 100644
--- a/examples/bootstrap.php
+++ b/examples/bootstrap.php
@@ -1,3 +1,7 @@
<?php
require_once dirname(__FILE__).'/../vendor/autoload.php';
+
+//pull in library options
+$optionsFile = file_get_contents(dirname(__FILE__).'/example-options.json');
+$options = json_decode($optionsFile, true);
diff --git a/examples/transmission/delete_transmission.php b/examples/transmission/delete_transmission.php
deleted file mode 100644
index f7d0530..0000000
--- a/examples/transmission/delete_transmission.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-namespace Examples\Transmisson;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
-
-try {
- $results = $sparky->transmission->delete('transmission-id');
- echo 'Transmission deleted!';
-} catch (\Exception $exception) {
- echo $exception->getAPIMessage()."\n";
- echo $exception->getAPICode()."\n";
- echo $exception->getAPIDescription()."\n";
-}
diff --git a/examples/transmission/get_all_transmissions.php b/examples/transmission/get_all_transmissions.php
deleted file mode 100644
index c037b2d..0000000
--- a/examples/transmission/get_all_transmissions.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-namespace Examples\Transmisson;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
-
-try {
- $results = $sparky->transmission->all();
- echo 'Congrats! You got a list of all your transmissions from SparkPost!';
-} catch (\Exception $exception) {
- echo $exception->getAPIMessage()."\n";
- echo $exception->getAPICode()."\n";
- echo $exception->getAPIDescription()."\n";
-}
diff --git a/examples/transmission/get_transmission.php b/examples/transmission/get_transmission.php
deleted file mode 100644
index 5d59740..0000000
--- a/examples/transmission/get_transmission.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-namespace Examples\Transmisson;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
-
-try {
- $results = $sparky->transmission->find('Your Transmission ID');
- echo 'Congrats! You retrieved your transmission from SparkPost!';
-} catch (\Exception $exception) {
- echo $exception->getAPIMessage()."\n";
- echo $exception->getAPICode()."\n";
- echo $exception->getAPIDescription()."\n";
-}
diff --git a/examples/transmission/rfc822.php b/examples/transmission/rfc822.php
deleted file mode 100644
index df2b06b..0000000
--- a/examples/transmission/rfc822.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-namespace Examples\Transmisson;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
-
-try {
- $results = $sparky->transmission->send([
- 'recipients' => [
- [
- 'address' => [
- 'email' => 'john.doe@example.com',
- ],
- ],
- ],
- 'rfc822' => "Content-Type: text/plain\nFrom: From Envelope <from@sparkpostbox.com>\nSubject: Example Email\n\nHello World",
- ]);
- echo 'Congrats! You sent an email using SparkPost!';
-} catch (\Exception $exception) {
- echo $exception->getAPIMessage()."\n";
- echo $exception->getAPICode()."\n";
- echo $exception->getAPIDescription()."\n";
-}
diff --git a/examples/transmission/send_transmission_all_fields.php b/examples/transmission/send_transmission_all_fields.php
deleted file mode 100644
index 84dfa9b..0000000
--- a/examples/transmission/send_transmission_all_fields.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-
-namespace Examples\Transmisson;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key'], 'timeout' => 0]]);
-
-$data = file_get_contents('/path/to/test.csv');
-
-try {
- $results = $sparky->transmission->send([
- 'campaign' => 'my-campaign',
- 'metadata' => [
- 'sample_campaign' => true,
- 'type' => 'these are custom fields',
- ],
- 'substitutionData' => [
- 'name' => 'Test Name',
- ],
- 'description' => 'my description',
- 'replyTo' => 'reply@test.com',
- 'customHeaders' => [
- 'X-Custom-Header' => 'Sample Custom Header',
- ],
- 'trackOpens' => false,
- 'trackClicks' => false,
- 'sandbox' => false,
- 'inlineCss' => true,
- 'transactional' => true,
- 'startTime' => '2016-03-17T08:00:00-04:00',
- 'from' => [
- 'name' => 'From Envelope',
- 'email' => 'from@sparkpostbox.com',
- ],
- 'html' => '<p>Hello World! Your name is: {{name}}</p>',
- 'text' => 'Hello World!',
- 'subject' => 'Example Email: {{name}}',
- 'recipients' => [
- [
- 'address' => [
- 'email' => 'john.doe@example.com',
- ],
- ],
- ],
- 'attachments' => [
- [
- 'type' => 'text/csv',
- 'name' => 'testing.csv',
- 'data' => base64_encode($data),
- ],
- ],
- 'inlineImages' => [
- [
- 'type' => 'image/png',
- 'name' => 'cid-name',
- 'data' => base64_encode($data),
- ],
- ],
- ]);
-
- echo 'Congrats! You sent an email using SparkPost!';
-} catch (\Exception $exception) {
- echo $exception->getAPIMessage()."\n";
- echo $exception->getAPICode()."\n";
- echo $exception->getAPIDescription()."\n";
-}
diff --git a/examples/transmission/send_with_bcc.php b/examples/transmission/send_with_bcc.php
deleted file mode 100644
index ce67862..0000000
--- a/examples/transmission/send_with_bcc.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-/*
- * For a more detailed explanation of how cc/bcc work with SparkPost, please
- * check out this article: https://support.sparkpost.com/customer/portal/articles/1948014
- */
-
-namespace Examples\Transmisson;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
-
-try {
- $results = $sparky->transmission->send([
- 'from' => [
- 'name' => 'From Envelope',
- 'email' => 'from@sparkpostbox.com',
- ],
- 'html' => '<p>An example email using bcc with SparkPost to the {{recipient_type}} recipient.</p>',
- 'text' => 'An example email using bcc with SparkPost to the {{recipient_type}} recipient.',
- 'subject' => 'Example email using bcc',
- 'recipients' => [
- [
- 'address' => [
- 'name' => 'Original Recipient',
- 'email' => 'original.recipient@example.com',
- ],
- 'substitution_data' => [
- 'recipient_type' => 'Original'
- ]
- ],
- [
- 'address' => [
- 'email' => 'bcc.recipient@example.com',
- 'header_to' => '"Original Recipient" <original.recipient@example.com>',
- ],
- 'substitution_data' => [
- 'recipient_type' => 'BCC'
- ]
- ],
- ],
- ]);
- echo 'Congrats! You sent an email with bcc using SparkPost!';
-} catch (\Exception $exception) {
- echo $exception->getAPIMessage()."\n";
- echo $exception->getAPICode()."\n";
- echo $exception->getAPIDescription()."\n";
-}
diff --git a/examples/transmission/send_with_cc.php b/examples/transmission/send_with_cc.php
deleted file mode 100644
index fa1d9e9..0000000
--- a/examples/transmission/send_with_cc.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-/*
- * For a more detailed explanation of how cc/bcc work with SparkPost, please
- * check out this article: https://support.sparkpost.com/customer/portal/articles/1948014
- */
-
-namespace Examples\Transmisson;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
-
-try {
- $results = $sparky->transmission->send([
- 'from' => [
- 'name' => 'From Envelope',
- 'email' => 'from@sparkpostbox.com',
- ],
- 'html' => '<p>An example email using cc with SparkPost to the {{recipient_type}} recipient.</p>',
- 'text' => 'An example email using cc with SparkPost to the {{recipient_type}} recipient.',
- 'subject' => 'Example email using cc',
- 'recipients' => [
- [
- 'address' => [
- 'name' => 'Original Recipient',
- 'email' => 'original.recipient@example.com',
- ],
- 'substitution_data' => [
- 'recipient_type' => 'Original'
- ]
- ],
- [
- 'address' => [
- 'name' => 'Carbon Copy Recipient',
- 'email' => 'cc.recipient@example.com',
- 'header_to' => '"Original Recipient" <original.recipient@example.com>',
- ],
- 'substitution_data' => [
- 'recipient_type' => 'CC'
- ]
- ],
- ],
- 'customHeaders' => [
- 'CC' => '"Carbon Copy Recipient" <cc.recipient@example.com>'
- ]
- ]);
- echo 'Congrats! You sent an email with cc using SparkPost!';
-} catch (\Exception $exception) {
- echo $exception->getAPIMessage()."\n";
- echo $exception->getAPICode()."\n";
- echo $exception->getAPIDescription()."\n";
-}
diff --git a/examples/transmission/simple_send.php b/examples/transmission/simple_send.php
deleted file mode 100644
index 6bd0336..0000000
--- a/examples/transmission/simple_send.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-namespace Examples\Transmisson;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
-
-try {
- $results = $sparky->transmission->send([
- 'from' => [
- 'name' => 'From Envelope',
- 'email' => 'from@sparkpostbox.com',
- ],
- 'html' => '<p>Hello World!</p>',
- 'text' => 'Hello World!',
- 'subject' => 'Example Email',
- 'recipients' => [
- [
- 'address' => [
- 'email' => 'john.doe@example.com',
- ],
- ],
- ],
- ]);
- echo 'Congrats! You sent an email using SparkPost!';
-} catch (\Exception $exception) {
- echo $exception->getAPIMessage()."\n";
- echo $exception->getAPICode()."\n";
- echo $exception->getAPIDescription()."\n";
-}
diff --git a/examples/transmission/stored_recipients_inline_content.php b/examples/transmission/stored_recipients_inline_content.php
deleted file mode 100644
index 503908b..0000000
--- a/examples/transmission/stored_recipients_inline_content.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-namespace Examples\Transmisson;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
-
-try {
- $results = $sparky->transmission->send([
- 'campaign' => 'my-campaign',
- 'from' => [
- 'name' => 'From Envelope',
- 'email' => 'from@sparkpostbox.com',
- ],
- 'html' => '<p>Hello World! Your name is: {{name}}</p>',
- 'text' => 'Hello World!',
- 'subject' => 'Example Email: {{name}}',
- 'recipientList' => 'Example List',
- ]);
-
- echo 'Congrats! You sent an email using SparkPost!';
-} catch (\Exception $exception) {
- echo $exception->getAPIMessage()."\n";
- echo $exception->getAPICode()."\n";
- echo $exception->getAPIDescription()."\n";
-}
diff --git a/examples/transmission/stored_template_send.php b/examples/transmission/stored_template_send.php
deleted file mode 100644
index 5ce48e4..0000000
--- a/examples/transmission/stored_template_send.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-namespace Examples\Transmisson;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
-
-try {
- $results = $sparky->transmission->send([
- 'from' => [
- 'name' => 'From Envelope',
- 'email' => 'from@sparkpostbox.com',
- ],
- 'recipients' => [
- [
- 'address' => [
- 'email' => 'john.doe@example.com',
- ],
- ],
- ],
- 'template' => 'my-first-email',
- ]);
- echo 'Congrats! You sent an email using SparkPost!';
-} catch (\Exception $exception) {
- echo $exception->getAPIMessage()."\n";
- echo $exception->getAPICode()."\n";
- echo $exception->getAPIDescription()."\n";
-}
diff --git a/examples/transmissions/create_transmission.php b/examples/transmissions/create_transmission.php
new file mode 100644
index 0000000..61478a8
--- /dev/null
+++ b/examples/transmissions/create_transmission.php
@@ -0,0 +1,46 @@
+<?php
+
+namespace Examples\Transmissions;
+
+require dirname(__FILE__).'/../bootstrap.php';
+
+use SparkPost\SparkPost;
+use GuzzleHttp\Client;
+use Http\Adapter\Guzzle6\Client as GuzzleAdapter;
+
+$httpClient = new GuzzleAdapter(new Client());
+
+/*
+ * configure options in example-options.json
+ */
+$sparky = new SparkPost($httpClient, $options);
+
+$promise = $sparky->transmissions->post([
+ 'content' => [
+ 'from' => [
+ 'name' => 'SparkPost Team',
+ 'email' => 'from@sparkpostbox.com',
+ ],
+ 'subject' => 'First Mailing From PHP',
+ 'html' => '<html><body><h1>Congratulations, {{name}}!</h1><p>You just sent your very first mailing!</p></body></html>',
+ 'text' => 'Congratulations, {{name}}!! You just sent your very first mailing!',
+ ],
+ 'substitution_data' => ['name' => 'YOUR_FIRST_NAME'],
+ 'recipients' => [
+ [
+ 'address' => [
+ 'name' => 'YOUR_NAME',
+ 'email' => 'YOUR_EMAIL',
+ ],
+ ],
+ ],
+]);
+
+try {
+ $response = $promise->wait();
+ echo $response->getStatusCode()."\n";
+ print_r($response->getBody())."\n";
+} catch (\Exception $e) {
+ echo $e->getCode()."\n";
+ echo $e->getMessage()."\n";
+}
diff --git a/examples/transmissions/create_transmission_with_cc_and_bcc.php b/examples/transmissions/create_transmission_with_cc_and_bcc.php
new file mode 100644
index 0000000..eab64b8
--- /dev/null
+++ b/examples/transmissions/create_transmission_with_cc_and_bcc.php
@@ -0,0 +1,62 @@
+<?php
+
+namespace Examples\Transmissions;
+
+require dirname(__FILE__).'/../bootstrap.php';
+
+use SparkPost\SparkPost;
+use GuzzleHttp\Client;
+use Http\Adapter\Guzzle6\Client as GuzzleAdapter;
+
+$httpClient = new GuzzleAdapter(new Client());
+
+/*
+ * configure options in example-options.json
+ */
+$sparky = new SparkPost($httpClient, $options);
+
+$promise = $sparky->transmissions->post([
+ 'content' => [
+ 'from' => [
+ 'name' => 'SparkPost Team',
+ 'email' => 'from@sparkpostbox.com',
+ ],
+ 'subject' => 'First Mailing From PHP',
+ 'html' => '<html><body><h1>Congratulations, {{name}}!</h1><p>You just sent your very first mailing!</p></body></html>',
+ 'text' => 'Congratulations, {{name}}!! You just sent your very first mailing!',
+ ],
+ 'substitution_data' => ['name' => 'YOUR_FIRST_NAME'],
+ 'recipients' => [
+ [
+ 'address' => [
+ 'name' => 'YOUR_NAME',
+ 'email' => 'YOUR_EMAIL',
+ ],
+ ],
+ ],
+ 'cc' => [
+ [
+ 'address' => [
+ 'name' => 'ANOTHER_NAME',
+ 'email' => 'ANOTHER_EMAIL',
+ ],
+ ],
+ ],
+ 'bcc' => [
+ [
+ 'address' => [
+ 'name' => 'AND_ANOTHER_NAME',
+ 'email' => 'AND_ANOTHER_EMAIL',
+ ],
+ ],
+ ],
+]);
+
+try {
+ $response = $promise->wait();
+ echo $response->getStatusCode()."\n";
+ print_r($response->getBody())."\n";
+} catch (\Exception $e) {
+ echo $e->getCode()."\n";
+ echo $e->getMessage()."\n";
+}
diff --git a/examples/transmissions/delete_transmission.php b/examples/transmissions/delete_transmission.php
new file mode 100644
index 0000000..ad0cc64
--- /dev/null
+++ b/examples/transmissions/delete_transmission.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace Examples\Transmissions;
+
+require dirname(__FILE__).'/../bootstrap.php';
+
+use SparkPost\SparkPost;
+use GuzzleHttp\Client;
+use Http\Adapter\Guzzle6\Client as GuzzleAdapter;
+
+$httpClient = new GuzzleAdapter(new Client());
+
+/*
+ * configure options in example-options.json
+ */
+$sparky = new SparkPost($httpClient, $options);
+
+$promise = $sparky->transmissions->delete('TRANSMISSION_ID');
+
+try {
+ $response = $promise->wait();
+ echo $response->getStatusCode()."\n";
+ print_r($response->getBody())."\n";
+} catch (\Exception $e) {
+ echo $e->getCode()."\n";
+ echo $e->getMessage()."\n";
+}
diff --git a/examples/transmissions/get_all_transmissions.php b/examples/transmissions/get_all_transmissions.php
new file mode 100644
index 0000000..0b4eb7f
--- /dev/null
+++ b/examples/transmissions/get_all_transmissions.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace Examples\Transmissions;
+
+require dirname(__FILE__).'/../bootstrap.php';
+
+use SparkPost\SparkPost;
+use GuzzleHttp\Client;
+use Http\Adapter\Guzzle6\Client as GuzzleAdapter;
+
+$httpClient = new GuzzleAdapter(new Client());
+
+/*
+ * configure options in example-options.json
+ */
+$sparky = new SparkPost($httpClient, $options);
+
+$promise = $sparky->transmissions->get();
+
+try {
+ $response = $promise->wait();
+ echo $response->getStatusCode()."\n";
+ print_r($response->getBody())."\n";
+} catch (\Exception $e) {
+ echo $e->getCode()."\n";
+ echo $e->getMessage()."\n";
+}
diff --git a/examples/unwrapped/create_template.php b/examples/unwrapped/create_template.php
deleted file mode 100644
index 89523f1..0000000
--- a/examples/unwrapped/create_template.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-namespace Examples\Unwrapped;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
-
-try {
- // define the endpoint
- $sparky->setupUnwrapped('templates');
-
- $templateConfig = [
- 'name' => 'Summer Sale!',
- 'id' => 'summer-sale',
- 'content' => [
- 'from' => 'from@sparkpostbox.com',
- 'subject' => 'Summer deals',
- 'html' => '<b>Check out these deals!</b>',
- ],
- ];
- $results = $sparky->templates->create($templateConfig);
- echo 'Congrats! You created a template using SparkPost!';
-} catch (\Exception $exception) {
- echo $exception->getMessage();
-}
diff --git a/examples/unwrapped/create_transmission.php b/examples/unwrapped/create_transmission.php
deleted file mode 100644
index f19ee6e..0000000
--- a/examples/unwrapped/create_transmission.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-namespace Examples\Unwrapped;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
-
-try {
- // define the endpoint
- $sparky->setupUnwrapped('transmissions');
-
- $message = [
- 'recipients' => [
- [
- 'address' => [
- 'email' => 'john.doe@example.com',
- ]
- ]
- ],
- 'content' => [
- 'from' => [
- 'name' => 'From Envelope',
- 'email' => 'from@sparkpostbox.com',
- ],
- 'html' => '<p>Hello World!</p>',
- 'text' => 'Hello World!',
- 'subject' => 'Example Email'
- ]
- ];
- $results = $sparky->transmissions->create($message);
- echo 'Congrats! You sent a message using SparkPost!';
-} catch (\Exception $exception) {
- echo $exception->getAPIMessage()."\n";
- echo $exception->getAPICode()."\n";
- echo $exception->getAPIDescription()."\n";
-}
-
diff --git a/examples/unwrapped/get_webhooks.php b/examples/unwrapped/get_webhooks.php
deleted file mode 100644
index 90f7a9c..0000000
--- a/examples/unwrapped/get_webhooks.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-namespace Examples\Unwrapped;
-
-require_once dirname(__FILE__).'/../bootstrap.php';
-
-//pull in API key config
-$configFile = file_get_contents(dirname(__FILE__).'/../example-config.json');
-$config = json_decode($configFile, true);
-
-use SparkPost\SparkPost;
-use GuzzleHttp\Client;
-use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-
-$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
-
-try {
- $sparky->setupUnwrapped('webhooks');
-
- $results = $sparky->webhooks->get();
-
- echo 'Congrats! You got a list of all your webhooks from SparkPost!';
-} catch (\Exception $exception) {
- echo $exception->getAPIMessage()."\n";
- echo $exception->getAPICode()."\n";
- echo $exception->getAPIDescription()."\n";
-}