A unified, driver-based mailbox SDK for Laravel.
- One API, every provider -- swap between Microsoft 365 and Google Workspace without changing a line of application code.
- Fluent query builder -- filter messages by folder, read status, date range, and free-text search with an Eloquent-like syntax.
- Delta sync built in -- track changes with provider-native delta tokens so you only process what is new.
- Typed DTOs everywhere -- every message, folder, and attachment comes back as a strict, readonly data-transfer object.
- Retry, rate-limit, and batch -- resilient HTTP handling with configurable backoff, concurrency locks, and queue-aware retry strategies.
- Rule matching engine -- evaluate inbound messages against user-defined filter rules with
MessageMatcherand expose filterable fields to your UI.
use Pyle\Mailbox\Facades\Mailbox;
use Pyle\Mailbox\Enums\WellKnownFolder;
$invoices = Mailbox::mailbox('invoices@acme.com')
->messages()
->inFolder(WellKnownFolder::INBOX)
->where('isRead', false)
->take(25)
->get(); // Collection<int, MessageDto>Five lines of code -- that is all it takes to pull the 25 most recent unread messages from any supported provider. Mailbox handles authentication, pagination, and provider-specific quirks behind the scenes so you can focus on what your application does with those messages.
| Driver | Key | Auth Model |
|---|---|---|
| Microsoft 365 (Graph API) | ms-graph |
Client credentials with mailbox-scoping policies |
| Google Workspace (Gmail API) | gmail |
Service-account delegation or user OAuth |
Tip The alias key
google-workspaceresolves to thegmaildriver, so you can use whichever name feels more natural in your configuration.
Full documentation lives in the docs/ directory. Here are the pages you will reach for most often:
- Installation -- requirements, Composer setup, publishing config and migrations.
- Configuration -- every option in
config/mailbox.php, explained. - Quickstart -- a working example in under two minutes.
- Messages -- querying, reading, moving, and deleting messages.
- Authentication -- provider-specific credential setup for MS Graph and Gmail.
- Create a feature branch from the latest default branch.
- Implement changes with tests and documentation updates where applicable.
- Run the full quality suite:
vendor/bin/pest
vendor/bin/phpstan analyse
vendor/bin/pint --test- Open a pull request with a clear summary, migration impact, and validation notes.
CI runs on PHP 8.2, 8.3, and 8.4 with latest dependencies, plus a PHP 8.2 prefer-lowest lane.
Mailbox is open-source software licensed under the MIT license.