Skip to content

Commit 3201c91

Browse files
committed
IHF: to_swiftmailer_emails docs added.
1 parent eb6fd0d commit 3201c91

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Provides Laravel-specific and pure PHP helper functions.
3131
- [Email](#email)
3232
- [is_email](#is_email)
3333
- [to_rfc2822_email](#to_rfc2822_email)
34+
- [to_swiftmailer_emails](#to_swiftmailer_emails)
3435
3536
- [Format](#format)
3637
- [format_bytes](#format_bytes)
@@ -108,7 +109,7 @@ $isEmail = is_email('[email protected]');
108109
109110
#### `to_rfc2822_email()`
110111
111-
Converts passed array of addresses data to [RFC 2822](http://www.faqs.org/rfcs/rfc2822.html) string, suitable for PHP [mail()](http://ua2.php.net/manual/en/function.mail.php) function:
112+
Converts addresses data to [RFC 2822](http://www.faqs.org/rfcs/rfc2822.html) string, suitable for PHP [mail()](http://ua2.php.net/manual/en/function.mail.php) function:
112113
```php
113114
$address = to_rfc2822_email([
114115
['address' => '[email protected]', 'name' => 'John Doe'],
@@ -125,6 +126,25 @@ $address = to_rfc2822_email(['address' => '[email protected]', 'name' => 'Joh
125126
// John Doe <[email protected]>
126127
```
127128
129+
#### `to_swiftmailer_emails()`
130+
131+
Converts addresses data to format, which is suitable for [SwiftMailer library](http://swiftmailer.org/docs/messages.html):
132+
```php
133+
$addresses = to_swiftmailer_emails([
134+
['address' => '[email protected]', 'name' => 'John Doe'],
135+
['address' => '[email protected]'],
136+
]);
137+
138+
// ["[email protected]" => "John Doe", "[email protected]"]
139+
```
140+
141+
Also supports simplified syntax for single address item:
142+
```php
143+
$address = to_swiftmailer_emails(['address' => '[email protected]', 'name' => 'John Doe']);
144+
145+
// ["[email protected]" => "John Doe"]
146+
```
147+
128148
## Format
129149
130150
#### `format_bytes()`

0 commit comments

Comments
 (0)