directorytree/imapengine
ImapEngine is a modern PHP IMAP library for reading and managing mailboxes with a clean, expressive API. It supports messages, attachments, flags, searches, folders, and Laravel integration, making email automation and inbox syncing simple and reliable.
ext-imap as a platform constraint. The library is native PHP and works standalone or with Laravel, so it unblocks hosting environments where the legacy extension is unavailable, deprecated, or blocked by security policy — a decision that otherwise surfaces late as an infrastructure blocker.bodyStructure, server-side SORT, bulk operations, poll()/idle() with timeout callback, mailbox quotas, UID sequence ranges, and Message-ID/RFC822.SIZE helpers. That is enough to prototype a shared team inbox, mailbox sync/archival, an attachment ingestion pipeline, or "connect your mailbox" in days rather than quarters.SORT and LARGER/SMALLER push filtering to the mail server instead of transferring and filtering in PHP. Single-request message fetching (v1.17.0) and sequence-range payload optimization (v1.25.6) cut round trips — meaningful when polling many mailboxes under per-connection or per-latency cost.Message-ID, In-Reply-To, RFC822.SIZE, Content-Disposition), and near-real-time notification via idle()/poll() without standing up a full push pipeline. If email is a commodity notification channel for your product, this is over-investment — use a transactional sender instead.MailService interface so DirectoryTree\ImapEngine\* types don't leak into your domain. That preserves the option to swap to Gmail API or Microsoft Graph later without touching product code, and it makes the "0 Packagist dependents" risk cheap to absorb.Consider adoption when:
imap_* calls or hand-rolled protocol work.ext-imap is unavailable, deprecated in your stack, or blocked by hosting/security policy.Look elsewhere when:
ext-imap is present and sufficient — the abstraction isn't worth the added dependency.One-liner for executives: We can ship mailbox-reading features — shared inboxes, search, attachment handling, near-real-time new-mail notifications — on top of a mature MIT-licensed PHP library instead of funding a quarter of protocol engineering, at zero license cost and with an exit path preserved.
For engineering: It's a modern, actively maintained native-PHP IMAP client with a fluent API, Laravel integration, and no ext-imap dependency. It already covers the hard parts we'd get wrong: lazy header/body/attachment loading, bulk operations, server-side SORT and size criteria, idle()/poll(), quotas, bodyStructure, and UID handling. Security-relevant fixes are landing regularly (command-injection escaping, safe token reads, socket error handling, MIME/RFC 2231 decoding, PHPStan 1–4). The trade: ~583 stars and no public dependents, so we pin versions, test against our target providers in CI, and keep the library behind an internal MailService interface.
The ask: Approve a small spike (one engineer, ~1–2 weeks) to build the adapter plus integration tests against Gmail, M365, and Dovecot. Success criteria: message list, search, attachment download, and new-mail polling working end-to-end through our interface, with no library types in the domain layer.
What we are explicitly not buying: SLA, support, attachment storage, or a sync engine. Those remain ours — and that's the honest cost of this decision.
How can I help you explore Laravel packages today?