diff options
author | Avi Goldman <avrahamymgoldman@gmail.com> | 2016-06-27 16:33:21 -0400 |
---|---|---|
committer | Avi Goldman <avrahamymgoldman@gmail.com> | 2016-06-27 16:33:21 -0400 |
commit | 5b332c106462a0a183f3d7112efcf567bcc906ed (patch) | |
tree | 4327f9f862e92885f1f0a35273c2e26af0d0d5dc | |
parent | 0746ce4e99e8a091dfbc5b7c40530dbaabb50197 (diff) | |
parent | c97ab22ccc109aa891f71007dea93f92477d95a7 (diff) | |
download | php-sparkpost-5b332c106462a0a183f3d7112efcf567bcc906ed.zip php-sparkpost-5b332c106462a0a183f3d7112efcf567bcc906ed.tar.gz php-sparkpost-5b332c106462a0a183f3d7112efcf567bcc906ed.tar.bz2 |
Merged FAD-3147
-rw-r--r-- | MIGRATION.md | 66 |
1 files changed, 64 insertions, 2 deletions
diff --git a/MIGRATION.md b/MIGRATION.md index f57c6fb..53710a4 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -17,7 +17,69 @@ Transmission endpoints are now under `$sparky->transmissions` instead of `$spark * The exceptions to the previous statement are `cc` and `bcc`. They are helpers to make it easier to add cc and bcc recipients. [Example](https://github.com/SparkPost/php-sparkpost/tree/2.0.0#send-an-email-using-the-transmissions-endpoint) ### Switched from Ivory Http Adapter to HTTPlug -Ivory Http Adapter was deprecated in favor fo HTTPlug. +Ivory Http Adapter was deprecated in favor of HTTPlug. ### Asynchronous support -We addeded in support for [asynchronous calls](https://github.com/SparkPost/php-sparkpost/tree/2.0.0#asynchronous) (assuming your client supports it).
\ No newline at end of file +We addeded in support for [asynchronous calls](https://github.com/SparkPost/php-sparkpost/tree/2.0.0#asynchronous) (assuming your client supports it). + +### Example +#### 2.0 +```php +try { + $sparky->setOptions([ 'async' => false ]); + // Build your email and send it! + $results = $sparky->transmissions->post([ + 'content'=>[ + 'from'=>[ + 'name' => 'From Envelope', + '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 FULL NAME', + 'email'=>'YOUR EMAIL ADDRESS' + ] + ] + ] + ]); + echo 'Woohoo! You just sent your first mailing!'; +} catch (\Exception $err) { + echo 'Whoops! Something went wrong'; + var_dump($err); +} +``` + +#### 1.0 +```php +try { + // Build your email and send it! + $results = $sparky->transmission->send([ + 'from'=>[ + 'name' => 'From Envelope', + 'email' => 'from@sparkpostbox.com>' + ], + '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!', + 'substitutionData'=>['name'=>'YOUR FIRST NAME'], + 'subject'=>'First Mailing From PHP', + 'recipients'=>[ + [ + 'address'=>[ + 'name'=>'YOUR FULL NAME', + 'email'=>'YOUR EMAIL ADDRESS' + ] + ] + ] + ]); + echo 'Woohoo! You just sent your first mailing!'; +} catch (\Exception $err) { + echo 'Whoops! Something went wrong'; + var_dump($err); +} +``` |