Skip to content

Commit 5b332c1

Browse files
committed
Merged FAD-3147
2 parents 0746ce4 + c97ab22 commit 5b332c1

File tree

1 file changed

+64
-2
lines changed

1 file changed

+64
-2
lines changed

MIGRATION.md

+64-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,69 @@ Transmission endpoints are now under `$sparky->transmissions` instead of `$spark
1717
* 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)
1818

1919
### Switched from Ivory Http Adapter to HTTPlug
20-
Ivory Http Adapter was deprecated in favor fo HTTPlug.
20+
Ivory Http Adapter was deprecated in favor of HTTPlug.
2121

2222
### Asynchronous support
23-
We addeded in support for [asynchronous calls](https://github.com/SparkPost/php-sparkpost/tree/2.0.0#asynchronous) (assuming your client supports it).
23+
We addeded in support for [asynchronous calls](https://github.com/SparkPost/php-sparkpost/tree/2.0.0#asynchronous) (assuming your client supports it).
24+
25+
### Example
26+
#### 2.0
27+
```php
28+
try {
29+
$sparky->setOptions([ 'async' => false ]);
30+
// Build your email and send it!
31+
$results = $sparky->transmissions->post([
32+
'content'=>[
33+
'from'=>[
34+
'name' => 'From Envelope',
35+
'email' => '[email protected]>'
36+
],
37+
'subject'=>'First Mailing From PHP',
38+
'html'=>'<html><body><h1>Congratulations, {{name}}!</h1><p>You just sent your very first mailing!</p></body></html>',
39+
'text'=>'Congratulations, {{name}}!! You just sent your very first mailing!',
40+
],
41+
'substitution_data'=>['name'=>'YOUR FIRST NAME'],
42+
'recipients'=>[
43+
[
44+
'address'=>[
45+
'name'=>'YOUR FULL NAME',
46+
'email'=>'YOUR EMAIL ADDRESS'
47+
]
48+
]
49+
]
50+
]);
51+
echo 'Woohoo! You just sent your first mailing!';
52+
} catch (\Exception $err) {
53+
echo 'Whoops! Something went wrong';
54+
var_dump($err);
55+
}
56+
```
57+
58+
#### 1.0
59+
```php
60+
try {
61+
// Build your email and send it!
62+
$results = $sparky->transmission->send([
63+
'from'=>[
64+
'name' => 'From Envelope',
65+
'email' => '[email protected]>'
66+
],
67+
'html'=>'<html><body><h1>Congratulations, {{name}}!</h1><p>You just sent your very first mailing!</p></body></html>',
68+
'text'=>'Congratulations, {{name}}!! You just sent your very first mailing!',
69+
'substitutionData'=>['name'=>'YOUR FIRST NAME'],
70+
'subject'=>'First Mailing From PHP',
71+
'recipients'=>[
72+
[
73+
'address'=>[
74+
'name'=>'YOUR FULL NAME',
75+
'email'=>'YOUR EMAIL ADDRESS'
76+
]
77+
]
78+
]
79+
]);
80+
echo 'Woohoo! You just sent your first mailing!';
81+
} catch (\Exception $err) {
82+
echo 'Whoops! Something went wrong';
83+
var_dump($err);
84+
}
85+
```

0 commit comments

Comments
 (0)