Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Imap Laravel Package

webklex/php-imap

PHP-IMAP is a pure-PHP IMAP client wrapper that works without the php-imap extension, supporting IMAP IDLE and OAuth auth. Optionally use php-imap for better decoding, edge cases, and legacy POP3 support.

View on GitHub
Deep Wiki
Context7

PHP-IMAP is a wrapper for common IMAP communication without the need to have the php-imap module installed / enabled. The protocol is completely integrated and therefore supports IMAP IDLE operation and the "new" oAuth authentication process as well.

Frequently asked questions about Php Imap
Can I use webklex/php-imap in Laravel without enabling the php-imap extension?
Yes, the package is designed to work entirely without the php-imap extension. It provides a pure-PHP implementation of IMAP, including OAuth2 and IDLE support, making it ideal for environments where the extension isn’t available, like shared hosting or Docker containers.
How does webklex/php-imap handle OAuth2 authentication for Gmail or Exchange?
The package fully supports OAuth2 authentication, including token refreshes and scopes. You’ll need to configure your OAuth credentials in the Laravel config or client manager, and the library handles the authentication flow seamlessly, including integration with providers like Google or Microsoft.
Does webklex/php-imap support real-time email processing with IMAP IDLE?
Yes, the package includes full IMAP IDLE support, allowing your Laravel application to receive real-time notifications when new emails arrive. This is particularly useful for applications requiring instant email processing, like chat systems or live notifications.
What Laravel versions does webklex/php-imap support?
The package is compatible with Laravel 5.5+ and PHP 7.4+. The latest versions (v6.x) require PHP 8.0+, while older versions (v5.x, v4.x) support PHP 7.0+. Check the [compatibility table](https://github.com/Webklex/php-imap#compatibility) for exact version mappings.
How do I integrate webklex/php-imap with Laravel’s service container and configuration?
Use the `webklex/laravel-imap` wrapper, which provides a ServiceProvider for easy registration. Configure your IMAP accounts in `config/imap.php`, then bind the client to Laravel’s container. The wrapper also supports events (e.g., `imap.message.fetched`) for reactive programming.
Can I use the native php-imap extension as a fallback for better performance or edge cases?
Yes, the package allows you to optionally enable the php-imap extension for improved decoding, handling of edge cases, or legacy POP3 support. Configure this in the client manager or Laravel config to switch between pure-PHP and native modes dynamically.
How do I handle large email attachments or bulk operations efficiently?
The package supports pagination for large datasets and batch operations. For attachments, you can stream them directly to storage (e.g., S3 or local filesystem) without loading everything into memory. Pair it with Laravel Queues for async processing of heavy operations.
Are there alternatives to webklex/php-imap for IMAP in Laravel?
Alternatives include native PHP’s `imap_*` functions (if the extension is available) or libraries like `spatie/laravel-mail`. However, `webklex/php-imap` stands out for its pure-PHP implementation, OAuth2/IDLE support, and deep Laravel integration, making it ideal for environments without the php-imap extension.
How do I test webklex/php-imap without a live IMAP server?
The package is mockable via its `ClientInterface`, allowing you to use tools like Mockery or Laravel’s testing helpers to simulate IMAP responses. The repository also provides Docker-based test IMAP servers for integration testing, ensuring your code works before deployment.
What are the potential performance bottlenecks with webklex/php-imap in production?
Heavy operations like fetching thousands of emails with attachments can strain memory or timeouts. Mitigate this by using pagination, Laravel Queues for async processing, and caching frequently accessed data. Monitor performance with Laravel’s logging and queue monitoring to catch issues early.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor