@@ -17,13 +17,14 @@ php composer.phar require jlinn/mandrill-api-php:~1.0
1717
1818Usage
1919=====
20+
2021Sending a Message
2122-----------------
2223
2324``` php
24- use Mandrill\Mandrill;
25- use Mandrill\Struct\Message;
26- use Mandrill\Struct\Recipient;
25+ use Jlinn\ Mandrill\Mandrill;
26+ use Jlinn\ Mandrill\Struct\Message;
27+ use Jlinn\ Mandrill\Struct\Recipient;
2728
2829// instantiate a client object
2930$mandrill = new Mandrill('your_api_key');
@@ -48,4 +49,39 @@ $message->addRecipient($recipient);
4849
4950// send the message
5051$response = $mandrill->messages()->send($message);
51- ```
52+ ```
53+
54+ Usage with Laravel 4.x
55+ =====
56+
57+ We have built a factory so that it's easier to use with Laravel 4.x facades.
58+
59+ Configuration
60+ -----------------
61+
62+ In order to publish the package configuration you need to perform the following command:
63+
64+ ```
65+ php artisan config:publish jlinn/mandrill-api-php
66+ ```
67+
68+ Change then the ` secret ` variable with your Mandrill secret key.
69+
70+ Sending a Message
71+ -----------------
72+
73+ ``` php
74+ $api = Mandrill::api();
75+
76+ $message = Mandrill::message([
77+ 'text' => 'Hello, *|NAME|*!',
78+ 'subject' => 'Test',
79+ 'from_email' => 'test@example.com',
80+ 'from_name' => 'Mandrill API Test'
81+ ]);
82+
83+ $recipient = Mandrill::recipient('recipient.email@example.com', 'Recipient Name');
84+ $recipient->addMergeVar('NAME', $recipient->name);
85+ $message->addRecipient($recipient);
86+
87+ $response = $api->messages()->send($message);
0 commit comments