horde / imap_client
IMAP client library
Package info
Type:horde-library
pkg:composer/horde/imap_client
Requires
- php: ^8.1
- ext-hash: *
- ext-json: *
- horde/eventdispatcher: ^1 || dev-FRAMEWORK_6_0
- horde/exception: ^3 || dev-FRAMEWORK_6_0
- horde/horde-installer-plugin: dev-FRAMEWORK_6_0 || ^3 || ^2
- horde/mail: ^3 || dev-FRAMEWORK_6_0
- horde/mime: ^3 || dev-FRAMEWORK_6_0
- horde/sasl: ^1 || dev-FRAMEWORK_6_0
- horde/secret: ^3 || dev-FRAMEWORK_6_0
- horde/socket_client: ^3.1 || dev-FRAMEWORK_6_0
- horde/stream: ^2 || dev-FRAMEWORK_6_0
- horde/stream_filter: ^3 || dev-FRAMEWORK_6_0
- horde/translation: ^3 || dev-FRAMEWORK_6_0
- horde/util: ^3 || dev-FRAMEWORK_6_0
Requires (Dev)
- horde/cache: ^3 || dev-FRAMEWORK_6_0
- horde/compress_fast: ^2 || dev-FRAMEWORK_6_0
- horde/crypt_blowfish: ^2 || dev-FRAMEWORK_6_0
- horde/db: ^3 || dev-FRAMEWORK_6_0
- horde/hashtable: ^2 || dev-FRAMEWORK_6_0
- horde/mongo: ^2 || dev-FRAMEWORK_6_0
- horde/pack: ^2 || dev-FRAMEWORK_6_0
- horde/stringprep: ^2 || dev-FRAMEWORK_6_0
- horde/support: ^3 || dev-FRAMEWORK_6_0
- psr/event-dispatcher: ^1
- psr/simple-cache: ^3
Suggests
- ext-intl: *
- ext-mbstring: *
- horde/cache: ^3 || dev-FRAMEWORK_6_0
- horde/compress_fast: ^2 || dev-FRAMEWORK_6_0
- horde/crypt_blowfish: ^2 || dev-FRAMEWORK_6_0
- horde/db: ^3 || dev-FRAMEWORK_6_0
- horde/hashtable: ^2 || dev-FRAMEWORK_6_0
- horde/mongo: ^2 || dev-FRAMEWORK_6_0
- horde/pack: ^2 || dev-FRAMEWORK_6_0
- horde/stringprep: ^2 || dev-FRAMEWORK_6_0
- horde/support: ^3 || dev-FRAMEWORK_6_0
Provides
None
Conflicts
None
Replaces
None
- dev-FRAMEWORK_6_0 / 3.x-dev
- v3.1.0
- v3.0.1
- v3.0.0
- v3.0.0RC2
- v3.0.0RC1
- v3.0.0beta2
- v3.0.0beta1
- v3.0.0alpha7
- v3.0.0alpha5
- v3.0.0alpha4
- v3.0.0alpha3
- 3.0.0alpha2
- 3.0.0alpha1
- v2.34.1
- v2.34.0
- v2.33.7
- v2.33.6
- v2.33.5
- v2.33.4
- v2.33.3
- v2.33.2
- v2.33.1
- v2.33.0
- v2.32.0
- v2.31.4
- v2.31.3
- v2.31.2
- v2.31.1
- v2.31.0
- 2.30.6
- 2.30.5
- 2.30.4
- 2.30.3
- 2.30.2
- 2.30.1
- 2.30.0
- 2.29.18
- 2.29.17
- 2.29.16
- 2.29.15
- 2.29.14
- 2.29.13
- 2.29.12
- 2.29.11
- 2.29.10
- 2.29.9
- 2.29.8
- 2.29.7
- 2.29.6
- 2.29.5
- 2.29.4
- 2.29.3
- 2.29.2
- 2.29.1
- 2.29.0
- 2.28.1
- 2.28.0
- 2.27.0
- 2.26.1
- 2.26.0
- 2.25.6
- 2.25.5
- 2.25.4
- 2.25.3
- 2.25.2
- 2.25.1
- 2.25.0
- 2.24.2
- 2.24.1
- 2.24.0
- 2.23.2
- 2.23.1
- 2.23.0
- 2.22.0
- 2.21.0
- 2.20.0
- 2.19.6
- 2.19.5
- 2.19.4
- 2.19.3
- 2.19.2
- 2.19.1
- 2.19.0
- 2.18.6
- 2.18.5
- 2.18.4
- 2.18.3
- 2.18.2
- 2.18.1
- 2.18.0
- 2.17.1
- 2.17.0
- 2.16.2
- 2.16.1
- 2.16.0
- v2.14.1
- v2.13.2
- 2.10.3
- 2.10.2
- 2.9.5
- 2.9.4
- 2.9.3
- 2.9.2
- 2.6.1
- 2.5.2
- 2.5.1
- 2.4.5
- 2.4.4
- 2.4.3
- 2.3.5
- 2.3.4
- 2.2.9
- 2.2.8
- dev-feat/imap-client-src
- dev-chore/fix-ci-findings
- dev-fix/getnamespaces-array-to-string
- dev-refactor/migrate-to-modern-hashtable-and-sessions
- dev-feat/src-public-api
- dev-fix/backport-bytestream-fixes
- dev-feat/modernize-test-suite
- dev-feat/icloud-imap
- dev-port/bytestream-22
- dev-port/bytestream-23
- dev-FRAMEWORK_5_2
- dev-master
This package is auto-updated.
Last update: 2026-08-29 17:32:20 UTC
README
An IMAP4rev1 / IMAP4rev2 (RFC 3501 / RFC 9051) and POP3 (RFC 1939) client library for PHP.
The package ships two codebases side by side:
src/(namespaceHorde\Imap\Client): the modern, PSR-4, PHP 8.2+ rewrite. Small final classes and immutable value objects, built onHorde\Socket\ClientandHorde\Sasl. This is the recommended API for new code.lib/(Horde_Imap_Client_*): the legacy PSR-0 engine, retained for backward compatibility. Functional but not actively developed.
Modern usage
use Horde\Imap\Client\ConnectionConfig; use Horde\Imap\Client\ImapClient; use Horde\Imap\Client\ImapFetchQuery; use Horde\Imap\Client\OpenMode; use Horde\Imap\Client\SecureMode; use Horde\Sasl\Credentials\PasswordCredentials; use Horde\Sasl\Credentials\PlainSecret; $client = new ImapClient( new ConnectionConfig(hostspec: 'imap.example.com', port: 993, secure: SecureMode::Ssl), new PasswordCredentials('alice', new PlainSecret('secret')), ); $client->login(); $client->openMailbox('INBOX', OpenMode::Readonly); $query = (new ImapFetchQuery())->envelope()->flags(); foreach ($client->fetch('INBOX', $client->getIdsOb('1:*'), $query) as $uid => $msg) { echo $uid . ': ' . $msg->getEnvelope()->subject . "\n"; } $client->logout();
ImapClient implements ImapProtocol (and MailboxProtocol), plus the
optional ImapAclAware, ImapQuotaAware and ImapMetadataAware
extension interfaces. Pop3Client implements MailboxProtocol.
Message caching is opt-in: pass an ImapCacheStore (backed by any PSR-16
cache) as the fifth ImapClient constructor argument and it is used
transparently across fetch, store and expunge.
Supported extensions
STARTTLS, SASL (via Horde\Sasl), CAPABILITY/ENABLE, IMAP4rev2,
UTF8=ACCEPT, UIDPLUS, MOVE, CONDSTORE/QRESYNC, ESEARCH, SORT/ESORT,
THREAD, LIST-EXTENDED, LIST-STATUS, NAMESPACE, ACL, QUOTA, METADATA,
MULTIAPPEND, CATENATE, BINARY and SEARCH=FUZZY.
Documentation
doc/UPGRADING.md: migrating from the legacylib/API to the modernsrc/clients, with a class-mapping table and before/after examples.doc/examples/imapclient.php: a runnable, read-only IMAP demonstration (capabilities, namespaces, mailbox list, status, fetch, search).doc/examples/pop3client.php: the equivalent POP3 demonstration.doc/POP3CAPABILITIES.md: what the POP3 client implements, what it deliberately does not and a server-compatibility matrix.
License
LGPL 2.1. See the enclosed LICENSE file.