Skip to content

Commit bb9b404

Browse files
committed
README updated & Facade example added
1 parent 16aa13d commit bb9b404

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
vendor
22
composer.lock
3-
.idea
3+
.idea
4+
test.php

README.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
[![Build Status][ico-travis]][link-travis]
66
[![Total Downloads][ico-downloads]][link-downloads]
77

8-
9-
[...]
10-
118
## Install
129

1310
Via Composer
@@ -81,7 +78,6 @@ tested in real live but it gives an impression on how things work.
8178
``` php
8279
use Webklex\IMAP\Client;
8380

84-
//Connect to the IMAP Server
8581
$oClient = new Client([
8682
'host' => 'somehost.com',
8783
'port' => 993,
@@ -90,13 +86,15 @@ $oClient = new Client([
9086
'username' => 'username',
9187
'password' => 'password',
9288
]);
89+
90+
//Connect to the IMAP Server
9391
$oClient->connect();
9492

9593
//Get all Mailboxes
9694
$aMailboxes = $oClient->getFolders();
9795

9896
//Loop through every Mailbox
99-
foreach($aMailboxes as $oMailboxes){
97+
foreach($aMailboxes as $oMailbox){
10098

10199
//Get all Messages of the current Mailbox
102100
foreach($oMailbox->getMessages() as $oMessage){
@@ -113,6 +111,30 @@ foreach($aMailboxes as $oMailboxes){
113111
}
114112
```
115113

114+
If you use the Facade ('Webklex\IMAP\Facades\Client') please select an account first:
115+
116+
``` php
117+
use Webklex\IMAP\Facades\Client;
118+
119+
$oClient = Webklex\IMAP\Facades\Client::account('default');
120+
$oClient->connect();
121+
```
122+
123+
You can define your accounts inside the config/imap.php file:
124+
```
125+
'accounts' => [
126+
'default' => [
127+
'host' => env('IMAP_HOST', 'localhost'),
128+
'port' => env('IMAP_PORT', 993),
129+
'encryption' => env('IMAP_ENCRYPTION', 'ssl'),
130+
'validate_cert' => env('IMAP_VALIDATE_CERT', true),
131+
'username' => env('IMAP_USERNAME', '[email protected]'),
132+
'password' => env('IMAP_PASSWORD', ''),
133+
],
134+
'gmail' => [.. ]
135+
]
136+
```
137+
116138
## Change log
117139

118140
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

0 commit comments

Comments
 (0)