Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gricob/imap
PHP IMAP client without php-imap extension dependency
https://github.com/gricob/imap
imap imap-client php php-library
Last synced: about 1 month ago
JSON representation
PHP IMAP client without php-imap extension dependency
- Host: GitHub
- URL: https://github.com/gricob/imap
- Owner: gricob
- Created: 2024-04-27T18:17:40.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-10-07T10:27:36.000Z (about 1 month ago)
- Last Synced: 2024-10-07T10:44:31.484Z (about 1 month ago)
- Topics: imap, imap-client, php, php-library
- Language: PHP
- Homepage:
- Size: 167 KB
- Stars: 1
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Quick start
## Install
```shell
composer require gricob/imap
```## Usage
```php
$client = \Gricob\IMAP\Client::create(
new \Gricob\IMAP\Configuration(
transport: 'ssl',
host: 'imap.example.com',
port: 993,
timeout: 60,
verifyPeer: true,
verifyPeerName: true,
allowSelfSigned: false,
useUid: true,
)
);$client->logIn('username', 'password');
// List available mailbox
$mailboxes = $client->mailboxes();// Select an specific mailbox
$client->select($mailboxes[0]);// Fetch message by sequence number or uid (depends on useUid configuration)
$message = $client->fetch(1);// Or search messages by criteria
$messages = $client->search()
->since(new DateTime('yesterday'))
->not()->header('In-Reply-To'))
->get();```
# Testing
[Greenmail standalone](https://greenmail-mail-test.github.io/greenmail/#deploy_docker_standalone) IMAP server is configured in the docker compose file for testing. To start it, run the following command:
```shell
docker compose up
```Once the IMAP server is up and running, run the following command to execute tests:
```shell
composer test
```