Skip to content

Commit 57f3ea0

Browse files
committed
Final touches
1 parent 8ee8631 commit 57f3ea0

File tree

1 file changed

+25
-22
lines changed

1 file changed

+25
-22
lines changed

readme.md

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@ PHP >= 8.1
3131

3232
## Installation
3333

34-
You can install the package via composer:
34+
Installation is done through composer:
3535

3636
```bash
3737
composer require directorytree/imapengine
3838
```
3939

4040
## Usage
4141

42+
ImapEngine provides a simple, fluent API for working with IMAP mailboxes, messages, and attachments.
43+
4244
### Connecting
4345

4446
To connect to a mailbox, create a new `Mailbox` instance with the configuration options:
@@ -80,7 +82,7 @@ $mailbox = new Mailbox([
8082
]);
8183
```
8284

83-
There are also many other configuration options available:
85+
There are also many other configuration options available you may find useful:
8486

8587
```php
8688
$mailbox = new Mailbox([
@@ -104,7 +106,9 @@ $mailbox = new Mailbox([
104106

105107
#### Debugging
106108

107-
The `debug` configuration option controls logging behavior for the mailbox. It accepts the following values:
109+
The `debug` configuration option controls logging behavior for the mailbox.
110+
111+
It accepts the following values:
108112

109113
**Boolean:**
110114
- `false` – (Default) Disables debugging output
@@ -201,11 +205,10 @@ $folder = $mailbox->folders()->find('Folder Name');
201205

202206
ImapEngine provides a fluent, chainable API for building advanced message search queries.
203207

204-
This allows you to combine various search criteria and options to retrieve exactly the messages you need.
205-
206-
For example, you can easily fetch all messages in a folder:
208+
This allows you to combine various search criteria and options to retrieve exactly the messages you need:
207209

208210
```php
211+
// Get the inbox folder.
209212
$inbox = $mailbox->folders()->inbox();
210213

211214
// Get all message UIDs in the inbox.
@@ -234,7 +237,7 @@ $messages = $inbox->messages()
234237
235238
#### Filtering By Criteria
236239

237-
The query builder supports many common IMAP search criteria. You can chain methods such as:
240+
The query builder supports many common IMAP search criteria. You may chain methods such as:
238241

239242
- `all()`
240243
- `new()`
@@ -271,7 +274,7 @@ $messages = $inbox->messages()
271274
->get();
272275
```
273276

274-
If a method doesn't exist for a specific search criteria, you can use the `where()` method to add custom criteria:
277+
If a method doesn't exist for a specific search criteria, you may use the `where()` method to add custom criteria:
275278

276279
```php
277280
$messages = $inbox->messages()
@@ -281,10 +284,12 @@ $messages = $inbox->messages()
281284

282285
#### Fetching Additional Message Data
283286

284-
By default, ImapEngine only fetches UIDs. To fetch additional message data, you have to enable it explicitly.
287+
By default, ImapEngine search queries only fetches UIDs.
285288

286-
**Message Headers:**
287-
Use `withHeaders()` to include headers in the result, or `withoutHeaders()` to exclude them.
289+
To fetch additional message data, you have to enable it explicitly.
290+
291+
**Message Flags:**
292+
Use `withFlags()` to retrieve flags, or `withoutFlags()` to omit them.
288293

289294
**Message Body:**
290295
Use `withBody()` to fetch the full body content, or `withoutBody()` to skip it.
@@ -293,9 +298,6 @@ Use `withBody()` to fetch the full body content, or `withoutBody()` to skip it.
293298
> The `withBody()` method fetches the full body content of the message, including attachments.
294299
> Keep this in mind when fetching messages, as it can be slow for large messages.
295300
296-
**Message Flags:**
297-
Use `withFlags()` to retrieve flags, or `withoutFlags()` to omit them.
298-
299301
For example, to fetch messages with both their bodies, headers, and flags:
300302

301303
```php
@@ -306,16 +308,17 @@ $messages = $inbox->messages()
306308
->get();
307309
```
308310

309-
The less data you fetch, the faster your query will be. Only fetch the data you need.
311+
**Message Headers:**
312+
Use `withHeaders()` to include headers in the result, or `withoutHeaders()` to exclude them.
310313

311314
#### Message Pagination
312315

313-
You can paginate messages using the `paginate()` method. This method accepts the number of messages to display per page:
316+
You may paginate messages using the `paginate()` method. This method accepts the number of messages to display per page:
314317

315318
> [!important]
316319
> IMAP does not support native pagination, as you would typically expect, like a SQL database. Instead,
317-
> ImapEngine retrieves all UID's from the selected folder, takes the slice of the UID's
318-
> that corresponds to the current page, and fetches the requested email message parts specifically for those UID's.
320+
> ImapEngine retrieves all UID's from the selected folder, takes the slice of the UID's that
321+
> corresponds to the current page, and fetches the requested email message parts specifically for those UID's.
319322
320323
```php
321324
// Paginate messages with 10 messages per page.
@@ -324,7 +327,7 @@ $paginatedMessages = $inbox->messages()->paginate(10);
324327

325328
#### Message Chunking
326329

327-
If you need to process a large number of messages without loading them all at once, you can use the chunk() method:
330+
If you need to process a large number of messages without loading them all at once, you may use the `chunk()` method:
328331

329332
```php
330333
$inbox->messages()->chunk(function ($chunk, $page) {
@@ -347,7 +350,7 @@ $inbox->messages()->each(function (Message $message) {
347350

348351
#### Finding a Specific Message
349352

350-
You can retrieve a single message by its unique identifier using the `find()` method.
353+
You may retrieve a single message by its unique identifier using the `find()` method.
351354

352355
The method accepts an ID and an ImapFetchIdentifier (an enum) that specifies whether the ID is a UID or a message sequence number.
353356

@@ -450,7 +453,7 @@ All these methods work by invoking the underlying IMAP `STORE` command (with the
450453

451454
#### Message Manipulation
452455

453-
Beyond just flagging, you can move or copy messages between folders, as well as delete them:
456+
Beyond just flagging, you may move or copy messages between folders, as well as delete them:
454457

455458
- `restore()`: Restores the message from the trash.
456459
- `copy(string $folder)`: Copies the message to the specified folder.
@@ -562,7 +565,7 @@ $inbox->idle(function (Message $message) {
562565

563566
By default, messages received in idle will not be fetched with all of their content (flags, headers, and body with attachments).
564567

565-
If you need to fetch the message content, you can set the query to fetch the desired content using the second argument of the `idle()` method:
568+
If you need to fetch the message content, you may set the query to fetch the desired content using the second argument of the `idle()` method:
566569

567570
```php
568571
use DirectoryTree\ImapEngine\MessageQuery;

0 commit comments

Comments
 (0)