### Instantiate ConfigureIdleQuery Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Command-Callbacks.md Example of initializing the configurer with specific message parts. ```php // User runs: imap:watch default --with=body,headers,flags // Parsed into array: ['body', 'headers', 'flags'] $configurer = new ConfigureIdleQuery(['body', 'headers', 'flags']); ``` -------------------------------- ### Example Execution Flow Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Command-Callbacks.md Demonstrates how the configurer modifies the query object based on input. ```php // Input: --with=body,headers $this->with = ['body', 'headers']; $configurer = new ConfigureIdleQuery($this->with); // When invoked $query = $configurer($messageQuery); // Equivalent to: $messageQuery->withBody(); $messageQuery->withHeaders(); // withFlags() NOT called return $messageQuery; ``` -------------------------------- ### Performance Optimization Commands Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Command-Callbacks.md CLI examples showing how different --with options impact bandwidth. ```bash imap:watch default # Default: no --with option ``` ```bash imap:watch default --with=flags ``` ```bash imap:watch default --with=body ``` ```bash imap:watch default --with=body,headers,flags ``` ```bash # For fast, lightweight watching imap:watch default --with=flags # For message storage with full content imap:watch default --with=body,headers # For debugging (all information) imap:watch default --with=body,headers,flags ``` -------------------------------- ### Complete Configuration Example Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/configuration.md The structure of the config/imap.php file, defining mailbox connections and proxy settings. ```php [ 'default' => [ 'port' => env('IMAP_PORT', 993), 'host' => env('IMAP_HOST'), 'timeout' => env('IMAP_TIMEOUT', 30), 'debug' => env('IMAP_DEBUG', false), 'username' => env('IMAP_USERNAME'), 'password' => env('IMAP_PASSWORD'), 'encryption' => env('IMAP_ENCRYPTION', 'ssl'), 'validate_cert' => env('IMAP_VALIDATE_CERT', true), 'authentication' => env('IMAP_AUTHENTICATION', 'plain'), 'proxy' => [ 'socket' => env('IMAP_PROXY_SOCKET'), 'username' => env('IMAP_PROXY_USERNAME'), 'password' => env('IMAP_PROXY_PASSWORD'), 'request_fulluri' => env('IMAP_PROXY_REQUEST_FULLURI', false), ], ], ], ]; ``` -------------------------------- ### Install Package via Composer Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/ImapServiceProvider.md Run this command in your terminal to install the package dependencies. ```bash composer require directorytree/imapengine-laravel ``` -------------------------------- ### Define Environment-Specific Configurations Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/configuration.md Examples of default, local, and production configuration structures for IMAP mailboxes. ```php return [ 'mailboxes' => [ 'default' => [ 'host' => env('IMAP_HOST'), 'username' => env('IMAP_USERNAME'), 'password' => env('IMAP_PASSWORD'), ], ], ]; ``` ```php return [ 'mailboxes' => [ 'default' => [ 'debug' => true, 'validate_cert' => false, ], ], ]; ``` ```php return [ 'mailboxes' => [ 'default' => [ 'debug' => false, 'timeout' => 60, ], ], ]; ``` -------------------------------- ### LoopInterface run Usage Example Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Loop-Support.md Demonstrates how to pass a callable to the run method. ```php $loop->run(function () { // This code executes repeatedly echo "Tick\n"; }); ``` -------------------------------- ### Supervisor Configuration Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/WatchMailbox-Command.md Example configuration for running the imap:watch command continuously using Supervisor. ```ini [program:imap-watch] process_name=%(program_name)s_%(process_num)02d command=php /path/to/app/artisan imap:watch default --with=body,headers autostart=true autorestart=true numprocs=1 redirect_stderr=true stdout_logfile=/var/log/imap-watch.log ``` -------------------------------- ### Loop Dependency Injection Example Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Loop-Support.md Injecting the LoopInterface into a class method. ```php public function handle(LoopInterface $loop): void { $loop->run($callback); } ``` -------------------------------- ### Usage example for HandleMessageReceived Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Command-Callbacks.md Demonstrates how to instantiate and pass the callback to the folder idle method, and how it behaves upon message arrival. ```php $folder->idle( new HandleMessageReceived($this, $name, $attempts, $lastReceivedAt), new ConfigureIdleQuery($with), $this->option('timeout'), ); ``` ```php // Handler is invoked $handler = new HandleMessageReceived( command: $watchCommand, mailbox: 'default', attempts: $retryCounter, // By reference lastReceivedAt: $lastTs, // By reference ); // New message received $handler($incomingMessage); // As a result: // - Console outputs: "Message received: [123]" // - $retryCounter becomes 0 // - $lastTs becomes current time // - Event listeners execute ``` -------------------------------- ### Configuration and Structure Arrays Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/types.md Examples of array structures used for mailbox configuration, message parts, and folder lists. ```php // Mailbox configuration [ 'host' => 'imap.example.com', 'port' => 993, 'username' => 'user@example.com', 'password' => 'password', 'encryption' => 'ssl', 'timeout' => 30, 'debug' => false, 'validate_cert' => true, 'authentication' => 'plain', 'proxy' => [ 'socket' => null, 'username' => null, 'password' => null, 'request_fulluri' => false, ], ] // Message parts array ['flags', 'body', 'headers'] // Folder structure ['INBOX', 'Sent', 'Drafts', '[Gmail]/Archived'] ``` -------------------------------- ### WatchMailbox CLI Usage Examples Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/WatchMailbox-Command.md Various command-line configurations for monitoring mailboxes, including polling, specific folder selection, and performance tuning. ```bash php artisan imap:watch default ``` ```bash php artisan imap:watch default "Sent Mail" ``` ```bash php artisan imap:watch default --method=poll ``` ```bash php artisan imap:watch default --with=body,headers,flags ``` ```bash php artisan imap:watch default --timeout=60 --attempts=10 ``` ```bash php artisan imap:watch default "Support" \ --method=poll \ --with=body,headers \ --timeout=45 \ --attempts=3 \ --debug=true ``` -------------------------------- ### systemd Service Configuration Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/WatchMailbox-Command.md Example systemd service file for managing the imap:watch command as a background process. ```ini [Unit] Description=IMAP Watch Service After=network.target [Service] Type=simple User=www-data WorkingDirectory=/path/to/app ExecStart=/usr/bin/php artisan imap:watch default Restart=always RestartSec=10 [Install] WantedBy=multi-user.target ``` -------------------------------- ### Valid Watch Method Options Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/errors.md Examples of valid command configurations for the imap:watch command. ```bash # Using IDLE (preferred, IDLE must be supported by server) php artisan imap:watch default --method=idle # Using polling (always works) php artisan imap:watch default --method=poll # Default is IDLE php artisan imap:watch default # same as --method=idle ``` -------------------------------- ### Bind LoopFake in Test Setup Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Loop-Support.md Register the LoopFake implementation in the service container during test setup to replace the default loop behavior. ```php use DirectoryTree\ImapEngine\Laravel\Support\LoopInterface; use DirectoryTree\ImapEngine\Laravel\Support\LoopFake; protected function setUp(): void { parent::setUp(); // Use the fake loop for all tests $this->app->bind(LoopInterface::class, LoopFake::class); } ``` -------------------------------- ### Catching Mailbox Configuration Exceptions Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/errors.md Example of wrapping mailbox access in a try-catch block to handle configuration errors and log available mailboxes. ```php use InvalidArgumentException; use DirectoryTree\ImapEngine\Laravel\Facades\Imap; try { $mailbox = Imap::mailbox('nonexistent'); } catch (InvalidArgumentException $e) { // Handle: Mailbox not configured Log::error("Mailbox error: " . $e->getMessage()); // List available mailboxes $configured = config('imap.mailboxes', []); Log::info("Available mailboxes: " . implode(', ', array_keys($configured))); } ``` -------------------------------- ### Testing WatchMailbox Command with LoopFake Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Loop-Support.md Example of binding LoopFake to the application container to test the imap:watch command. ```php use DirectoryTree\ImapEngine\Laravel\Commands\WatchMailbox; use DirectoryTree\ImapEngine\Laravel\Support\LoopFake; use DirectoryTree\ImapEngine\Laravel\Facades\Imap; public function test_watch_command_processes_one_message() { // Bind the fake loop for this test $this->app->bind(LoopInterface::class, LoopFake::class); // Create a fake mailbox $fake = Imap::fake('default'); // Simulate a message $fake->receiveMessage([...]); // Run the command $this->artisan('imap:watch default') ->assertExitCode(0); // The callback ran exactly once } ``` -------------------------------- ### Loop Class Usage Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Loop-Support.md Example of using the Loop class to process mailbox messages in a continuous loop. ```php use DirectoryTree\ImapEngine\Laravel\Support\Loop; $loop = new Loop(); $loop->run(function () { // Check for messages $messages = $mailbox->inbox()->messages()->all(); // Process each message foreach ($messages as $message) { handleMessage($message); } }); ``` -------------------------------- ### Usage of LoopFake Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Loop-Support.md Demonstrates how to instantiate and run the LoopFake to execute a callback once. ```php use DirectoryTree\ImapEngine\Laravel\Support\LoopFake; $loop = new LoopFake(); $invocations = 0; $loop->run(function () use (&$invocations) { $invocations++; }); // $invocations === 1 ``` -------------------------------- ### ConfigureIdleQuery Callback Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/WatchMailbox-Command.md Configures message fetching parameters based on the --with option. ```php new ConfigureIdleQuery($with) ``` -------------------------------- ### Publish Configuration Files Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/ImapServiceProvider.md Execute the artisan command to publish the package configuration to your application. ```bash php artisan vendor:publish --provider="DirectoryTree\\ImapEngine\\Laravel\\ImapServiceProvider" ``` -------------------------------- ### Override Loop for Testing Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/ImapServiceProvider.md Bind the LoopFake implementation to the LoopInterface in your test setup to avoid real network connections. ```php use DirectoryTree\ImapEngine\Laravel\Support\LoopInterface; use DirectoryTree\ImapEngine\Laravel\Support\LoopFake; protected function setUp(): void { parent::setUp(); // Use fake loop for testing $this->app->bind(LoopInterface::class, LoopFake::class); } ``` -------------------------------- ### ConfigureIdleQuery Error Handling Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Command-Callbacks.md Shows how to handle query configuration errors by allowing exceptions to propagate to the watch loop. ```php public function __invoke(MessageQueryInterface $query): MessageQueryInterface { try { if (in_array('body', $this->with)) { $query->withBody(); // Could fail if body is unavailable } return $query; } catch (Exception $e) { // Error during query configuration // Exception propagates to watch loop throw $e; } } ``` -------------------------------- ### Fluent Interface Usage Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/types.md Demonstrates chaining methods that return the calling instance. ```php $manager->register('box1', $config1) ->register('box2', $config2) ->forget('box1'); ``` -------------------------------- ### Handling MailboxWatchAttemptsExceeded Event Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/errors.md Example event listener for logging and alerting when mailbox watch attempts exceed the configured threshold. ```php use DirectoryTree\ImapEngine\Laravel\Events\MailboxWatchAttemptsExceeded; use Illuminate\Support\Facades\Log; class HandleMailboxFailure { public function handle(MailboxWatchAttemptsExceeded $event): void { Log::critical('Mailbox watch failed', [ 'mailbox' => $event->mailbox, 'attempts' => $event->attempts, 'error' => $event->exception->getMessage(), 'last_success' => $event->lastReceivedAt?->format('Y-m-d H:i:s'), ]); // Alert administrators $this->alertAdministrators($event); } } ``` -------------------------------- ### Configure Encryption and Ports Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/configuration.md Settings for SSL, TLS, and unencrypted connections. ```php 'encryption' => 'ssl', 'port' => 993, ``` ```php 'encryption' => 'tls', 'port' => 143, ``` ```php 'encryption' => 'none', 'port' => 143, ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/configuration.md Set mailbox and proxy settings in the .env file. ```env # Default mailbox IMAP_HOST=imap.gmail.com IMAP_PORT=993 IMAP_USERNAME=your-email@gmail.com IMAP_PASSWORD=your-app-password IMAP_ENCRYPTION=ssl IMAP_TIMEOUT=30 IMAP_DEBUG=false IMAP_VALIDATE_CERT=true IMAP_AUTHENTICATION=plain # Proxy settings (optional) IMAP_PROXY_SOCKET= IMAP_PROXY_USERNAME= IMAP_PROXY_PASSWORD= IMAP_PROXY_REQUEST_FULLURI=false ``` -------------------------------- ### Initialize ImapManager Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/ImapManager.md Instantiate the manager using a configuration array containing mailbox definitions. ```php $config = [ 'mailboxes' => [ 'default' => [ 'host' => 'imap.gmail.com', 'port' => 993, 'username' => 'user@gmail.com', 'password' => 'app_password', 'encryption' => 'ssl', ], ], ]; $manager = new ImapManager($config); ``` -------------------------------- ### Project Directory Structure Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/DOCUMENTATION_INDEX.md Overview of the file system layout for the IMAP Engine Laravel project. ```text /workspace/home/output/ ├── README.md # Main overview ├── DOCUMENTATION_INDEX.md # This file ├── types.md # Type definitions ├── configuration.md # Configuration reference ├── errors.md # Error catalog └── api-reference/ ├── ImapManager.md # Service API ├── ImapServiceProvider.md # Bootstrap ├── Imap-Facade.md # Static interface ├── WatchMailbox-Command.md # Main command ├── Command-Callbacks.md # Callbacks ├── Loop-Support.md # Loop abstraction └── Events.md # Event classes ``` -------------------------------- ### Load Environment-Specific Config Files Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/configuration.md Logic to merge environment-specific configuration files into the main IMAP configuration array. ```php $config = include __DIR__ . '/imap.php'; if ($env = config('app.env')) { $envConfig = __DIR__ . "/imap/{$env}.php"; if (file_exists($envConfig)) { $config = array_merge_recursive($config, include $envConfig); } } return $config; ``` -------------------------------- ### Interacting with Mailboxes and Folders Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/types.md Shows how to retrieve a mailbox instance via the Imap facade and perform operations like accessing the inbox or listing folders. ```php use DirectoryTree\ImapEngine\Laravel\Facades\Imap; $mailbox = Imap::mailbox('default'); // Get the inbox $inbox = $mailbox->inbox(); // Get all folders $folders = $mailbox->folders()->all(); // Find a specific folder $sentFolder = $mailbox->folders()->find('Sent'); ``` -------------------------------- ### Implement Loop Abstractions Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/README.md Use Loop for infinite production execution and LoopFake for single-iteration testing scenarios. ```php // Production: runs forever $loop = new Loop(); $loop->run(function () { // Check for messages }); // Testing: runs once $loop = new LoopFake(); $loop->run(function () { // Runs exactly once }); ``` -------------------------------- ### Manage Multiple Mailboxes Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Imap-Facade.md Shows how to handle multiple distinct mailbox connections simultaneously. ```php use DirectoryTree\ImapEngine\Laravel\Facades\Imap; // Work with multiple configured mailboxes $customerMailbox = Imap::mailbox('customer_support'); $adminMailbox = Imap::mailbox('admin'); // Each maintains its own connection $customerInbox = $customerMailbox->inbox(); $adminInbox = $adminMailbox->inbox(); ``` -------------------------------- ### Access Mailboxes and Messages Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Imap-Facade.md Demonstrates basic mailbox retrieval, folder listing, and message fetching using the Imap facade. ```php use DirectoryTree\ImapEngine\Laravel\Facades\Imap; // Access the default mailbox $mailbox = Imap::mailbox('default'); // List all folders $folders = $mailbox->folders()->all(); // Access inbox $inbox = $mailbox->inbox(); // Fetch messages $messages = $inbox->messages()->all(); ``` -------------------------------- ### Configure IMAP environment variables Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/START_HERE.md Set the required connection credentials in the .env file. ```env IMAP_HOST=imap.gmail.com IMAP_USERNAME=your-email@gmail.com IMAP_PASSWORD=your-app-password ``` -------------------------------- ### Boot method signature Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/ImapServiceProvider.md The signature for the boot method used during the service provider boot phase. ```php public function boot(): void ``` -------------------------------- ### Test ConfigureIdleQuery Configurer Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Command-Callbacks.md Verifies that the ConfigureIdleQuery class correctly applies query methods to the provided message query interface. ```php use DirectoryTree\ImapEngine\Laravel\Commands\ConfigureIdleQuery; public function test_configurer_adds_query_methods() { $query = Mockery::mock(MessageQueryInterface::class); $query->shouldReceive('withBody')->once(); $query->shouldReceive('withHeaders')->once(); $query->shouldReceive('withFlags')->never(); $query->shouldReceive('__toString')->andReturn('query'); $configurer = new ConfigureIdleQuery(['body', 'headers']); $result = $configurer($query); $this->assertSame($query, $result); } ``` -------------------------------- ### View File Organization Structure Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/START_HERE.md Displays the directory structure of the documentation files within the project. ```text /output/ ├── START_HERE.md ← You are here ├── README.md ← Overview & quick start ├── DOCUMENTATION_INDEX.md ← Complete index ├── COMPLETION_REPORT.md ← What's covered │ ├── types.md ← Type definitions ├── configuration.md ← Configuration guide ├── errors.md ← Error catalog │ └── api-reference/ ← API Reference ├── ImapManager.md ← Main service (6 methods) ├── Imap-Facade.md ← Static interface (3 methods) ├── ImapServiceProvider.md ← Bootstrap (2 methods) ├── WatchMailbox-Command.md ← Console command (4 methods) ├── Command-Callbacks.md ← Callbacks (2 classes) ├── Loop-Support.md ← Loop abstraction (3 classes) └── Events.md ← Events (2 event classes) ``` -------------------------------- ### Declare Imap Facade Methods Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Imap-Facade.md PHPDoc annotations for IDE autocomplete and static analysis support. ```php /** * @method static MailboxInterface mailbox(string $name) * @method static MailboxInterface swap(string $name, MailboxInterface $mailbox) */ ``` -------------------------------- ### Configure Postfix with Courier Connection Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/configuration.md Standard configuration for self-hosted Postfix/Courier servers using TLS. ```php 'postfix' => [ 'host' => 'mail.example.com', 'port' => 143, 'username' => 'user', 'password' => 'password', 'encryption' => 'tls', ] ``` -------------------------------- ### Artisan command for publishing configuration Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/ImapServiceProvider.md Command to publish the package configuration to the Laravel application. ```bash php artisan vendor:publish --provider="DirectoryTree\ImapEngine\Laravel\ImapServiceProvider" ``` -------------------------------- ### Default configuration structure Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/ImapServiceProvider.md The structure of the published imap.php configuration file. ```php return [ 'mailboxes' => [ 'default' => [ 'port' => env('IMAP_PORT', 993), 'host' => env('IMAP_HOST'), 'timeout' => env('IMAP_TIMEOUT', 30), 'debug' => env('IMAP_DEBUG', false), 'username' => env('IMAP_USERNAME'), 'password' => env('IMAP_PASSWORD'), 'encryption' => env('IMAP_ENCRYPTION', 'ssl'), 'validate_cert' => env('IMAP_VALIDATE_CERT', true), 'authentication' => env('IMAP_AUTHENTICATION', 'plain'), 'proxy' => [ 'socket' => env('IMAP_PROXY_SOCKET'), 'username' => env('IMAP_PROXY_USERNAME'), 'password' => env('IMAP_PROXY_PASSWORD'), 'request_fulluri' => env('IMAP_PROXY_REQUEST_FULLURI', false), ], ], ], ]; ``` -------------------------------- ### Register Mailboxes at Runtime Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/ImapManager.md Programmatically add mailbox connections to the manager, supporting dynamic or multi-tenant configurations. ```php $manager->register('customer_mailbox', [ 'host' => 'imap.example.com', 'port' => 993, 'username' => 'customer@example.com', 'password' => 'secret', 'encryption' => 'ssl', 'authentication' => 'plain', ]); $mailbox = $manager->mailbox('customer_mailbox'); ``` ```php $manager ->register('mailbox1', $config1) ->register('mailbox2', $config2) ->register('mailbox3', $config3); ``` -------------------------------- ### Publish configuration file Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/ImapServiceProvider.md Registers the package configuration file to be publishable to the application's config directory. ```php $this->publishes([ __DIR__.'/../config/imap.php' => config_path('imap.php'), ]); ``` -------------------------------- ### Enable Debug Mode via Artisan Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/errors.md Run this command to enable detailed logging of IMAP protocol communication. ```bash php artisan imap:watch default --debug=true ``` -------------------------------- ### Interact with FolderInterface Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/types.md Demonstrates retrieving an inbox and watching for new messages using the IDLE method. ```php use DirectoryTree\ImapEngine\Laravel\Facades\Imap; $mailbox = Imap::mailbox('default'); $inbox = $mailbox->inbox(); // Get messages $messages = $inbox->messages()->all(); // Watch for new messages with IDLE $inbox->idle( function ($message) { // Handle message }, function ($query) { // Configure query return $query->withBody(); }, 30 // timeout ); ``` -------------------------------- ### Usage and testing of LoopInterface Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/ImapServiceProvider.md Shows dependency injection, direct resolution, and overriding the binding for testing purposes. ```php // Dependency injection public function handle(LoopInterface $loop): void { $loop->run($callback); } // Direct resolution $loop = app(LoopInterface::class); // Override in tests $this->app->bind(LoopInterface::class, LoopFake::class); ``` -------------------------------- ### Imap::fake(string $mailbox, array $config, array $folders, array $capabilities) Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Imap-Facade.md Creates and registers a fake mailbox for testing purposes. ```APIDOC ## Imap::fake(string $mailbox, array $config, array $folders, array $capabilities) ### Description A testing convenience method that creates a FakeMailbox instance with the provided configuration and automatically registers it via swap(). ### Parameters - **mailbox** (string) - Required - The mailbox name to fake. - **config** (array) - Optional - Configuration array for the fake mailbox. - **folders** (array) - Optional - Folder structure to populate. - **capabilities** (array) - Optional - IMAP server capabilities. ### Return Type FakeMailbox ### Example ```php use DirectoryTree\ImapEngine\Laravel\Facades\Imap; $fake = Imap::fake('default', folders: ['INBOX', 'Sent']); ``` ``` -------------------------------- ### Access registered services Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/ImapServiceProvider.md Demonstrates how to retrieve the ImapManager instance via the service container, Facade, or dependency injection. ```php // Via the service container $manager = app(ImapManager::class); // Via the Facade $manager = Imap::getFacadeRoot(); // Via dependency injection public function handle(ImapManager $manager) { $mailbox = $manager->mailbox('default'); } ``` -------------------------------- ### Configure Mailbox Settings Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/DOCUMENTATION_INDEX.md Define mailbox connection details in the configuration file. ```php // config/imap.php 'mailboxes' => [ 'default' => [ 'host' => env('IMAP_HOST'), 'port' => env('IMAP_PORT', 993), 'username' => env('IMAP_USERNAME'), 'password' => env('IMAP_PASSWORD'), ], ] ``` -------------------------------- ### Switching to Polling for Server Support Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/errors.md Command to use polling when the server does not support IDLE. ```bash # Try polling instead php artisan imap:watch default --method=poll ``` -------------------------------- ### Configure Dovecot Connection Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/configuration.md Standard configuration for self-hosted Dovecot servers. ```php 'dovecot' => [ 'host' => 'mail.example.com', 'port' => 993, 'username' => 'user', 'password' => 'password', 'encryption' => 'ssl', ] ``` -------------------------------- ### Build Temporary Mailbox Instances Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/ImapManager.md Create a new MailboxInterface instance without caching it in the manager. ```php $tempConfig = [ 'host' => 'imap.temp.com', 'port' => 993, 'username' => 'temp@example.com', 'password' => 'temp_pass', ]; $tempMailbox = $manager->build($tempConfig); // Use the mailbox $inbox = $tempMailbox->inbox(); ``` -------------------------------- ### Custom Query Configuration Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Command-Callbacks.md Implementing a custom callback to extend query behavior beyond standard options. ```php namespace App\Commands; use DirectoryTree\ImapEngine\MessageQueryInterface; class CustomConfigureIdleQuery { public function __invoke(MessageQueryInterface $query): MessageQueryInterface { // Always fetch body and headers $query->withBody(); $query->withHeaders(); // Limit to recent messages $query->limit(100); return $query; } } ``` ```php // In your custom command $folder->idle( new HandleMessageReceived(...), new CustomConfigureIdleQuery(), 30, ); ``` -------------------------------- ### Configure Service Provider Discovery Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/ImapServiceProvider.md Add the provider to the extra.laravel.providers array in composer.json to enable automatic registration. ```json { "extra": { "laravel": { "providers": [ "DirectoryTree\\ImapEngine\\Laravel\\ImapServiceProvider" ] } } } ``` -------------------------------- ### Query messages with MessageQueryInterface Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/types.md Shows how to fetch messages with specific parts, retrieve the first message, and limit result sets. ```php use DirectoryTree\ImapEngine\Laravel\Facades\Imap; $mailbox = Imap::mailbox('default'); $inbox = $mailbox->inbox(); // Get messages with specific parts $messages = $inbox->messages() ->withBody() ->withHeaders() ->withFlags() ->all(); // Get first message $first = $inbox->messages() ->withBody() ->first(); // Limit results $recent = $inbox->messages() ->limit(10) ->all(); ``` -------------------------------- ### Configuring and Registering Mailboxes Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/errors.md Methods to resolve mailbox configuration errors via the config file or programmatic registration. ```php 'mailboxes' => [ 'default' => [...], 'support' => [...], // Add the mailbox here ] ``` ```php Imap::register('support', [ 'host' => 'imap.example.com', 'username' => 'support@example.com', 'password' => 'password', ]); ``` -------------------------------- ### LoopInterface run Method Signature Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Loop-Support.md The method signature for the run function. ```php public function run(callable $tick): void ``` -------------------------------- ### ImapEngine Type Hierarchy Structure Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/types.md Visual representation of the class and interface inheritance tree for the ImapEngine package. ```text Exception ├── InvalidArgumentException (from PHP) └── (various ImapEngine exceptions) MailboxInterface (from ImapEngine) └── (implementations) FolderInterface (from ImapEngine) └── (implementations) MessageInterface (from ImapEngine) └── (implementations) FakeMailbox (from ImapEngine Testing) ├── implements MailboxInterface └── test-specific methods LoopInterface (from ImapEngine Laravel) ├── Loop └── LoopFake ``` -------------------------------- ### swap(string $name, MailboxInterface $mailbox): void Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/ImapManager.md Replaces a mailbox instance with a different one, typically used for testing with fake mailboxes. ```APIDOC ## swap(string $name, MailboxInterface $mailbox): void ### Description Replaces the cached mailbox instance with a different implementation. Primarily used in testing to inject FakeMailbox implementations for assertions without hitting real IMAP servers. ### Parameters - **name** (string) - Required - The name of the mailbox to replace - **mailbox** (MailboxInterface) - Required - The replacement mailbox instance ### Return Type - **void** ### Example ```php $manager->swap('default', $fakeMailbox); ``` ``` -------------------------------- ### register(string $name, array $config): static Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/ImapManager.md Registers a new mailbox instance with runtime configuration, bypassing the static configuration file. ```APIDOC ## register(string $name, array $config) ### Description Allows programmatic registration of mailbox connections at runtime. This is useful for dynamic configurations or multi-tenant scenarios where mailbox credentials are stored in a database. ### Parameters - **name** (string) - Required - The unique name to register the mailbox under - **config** (array) - Required - Connection configuration for the mailbox ### Returns - **static** - The ImapManager instance for fluent interface ``` -------------------------------- ### Configure IMAP Authentication Method Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/errors.md Set the authentication method in the configuration file to resolve login issues. ```php 'authentication' => 'plain', // Try this first 'authentication' => 'login', // Or this ``` -------------------------------- ### Create and Register Fake Mailbox Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Imap-Facade.md Create a fake mailbox instance and automatically register it for testing. ```php public static function fake( string $mailbox, array $config = [], array $folders = [], array $capabilities = [] ): FakeMailbox ``` ```php use DirectoryTree\ImapEngine\Laravel\Facades\Imap; // Create a fake mailbox for testing $fake = Imap::fake('default', folders: [ 'INBOX', 'Sent', 'Drafts', ]); // The fake is now registered and accessible $mailbox = Imap::mailbox('default'); // $mailbox is the fake instance // Use fake assertions $fake->assertMessageWasReceived(); ``` ```php use DirectoryTree\ImapEngine\Laravel\Facades\Imap; use PHPUnit\Framework\TestCase; class MailboxTest extends TestCase { public function test_message_processing() { $fake = Imap::fake('default'); // Simulate receiving a message $fake->receiveMessage(...); // Test code that processes messages $this->assertTrue($fake->messageWasProcessed()); } } ``` -------------------------------- ### Usage in Watch Loop Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Command-Callbacks.md How to pass the callback into the idle method of a mailbox folder. ```php // In WatchMailbox::handle() $with = explode(',', $this->option('with')); $folder->idle( new HandleMessageReceived($this, $name, $attempts, $lastReceivedAt), new ConfigureIdleQuery($with), $this->option('timeout'), ); ``` ```php // When message is received, library calls: $configuredQuery = $configureCallback($messageQuery); $messages = $configuredQuery->all(); ``` -------------------------------- ### Verify IMAP Configuration Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/errors.md Use this snippet to inspect the current configuration and test the mailbox connection. ```php use DirectoryTree\ImapEngine\Laravel\Facades\Imap; $config = config('imap'); var_dump($config); try { $mailbox = Imap::mailbox('default'); echo "Configuration is valid\n"; } catch (Exception $e) { echo "Error: " . $e->getMessage() . "\n"; } ``` -------------------------------- ### Accessing Message Metadata and Content Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/types.md Demonstrates how to retrieve message details like UID, sender, subject, and body from a MessageReceived event. ```php use DirectoryTree\ImapEngine\Laravel\Events\MessageReceived; use Illuminate\Events\Dispatcher; $dispatcher->listen(MessageReceived::class, function (MessageReceived $event) { $message = $event->message; $uid = $message->uid(); $from = $message->from(); $subject = $message->subject(); if ($message->body()) { $body = $message->body(); } }); ``` -------------------------------- ### build(array $config): MailboxInterface Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/ImapManager.md Creates a new MailboxInterface instance from a configuration array without caching. ```APIDOC ## build(array $config) ### Description Creates a fresh Mailbox instance without storing it in the internal cache. Each call produces a new instance, useful when you need temporary connections or non-registered mailboxes. ### Parameters - **config** (array) - Required - Connection configuration array ### Returns - **MailboxInterface** - A new mailbox instance ``` -------------------------------- ### Implement LimitedLoop Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Loop-Support.md Creates a loop that executes for a fixed number of iterations. ```php class LimitedLoop implements LoopInterface { public function __construct( private int $maxIterations, ) {} public function run(callable $tick): void { for ($i = 0; $i < $this->maxIterations; $i++) { $tick(); } } } ``` -------------------------------- ### Correct and Incorrect Watch Method Usage Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/errors.md Comparison of valid and invalid command line arguments for the watch method option. ```bash # Correct php artisan imap:watch default --method=idle php artisan imap:watch default --method=poll # Incorrect - will throw error php artisan imap:watch default --method=imap-idle php artisan imap:watch default --method=check ``` -------------------------------- ### Test IMAP Connectivity Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/errors.md Use telnet to verify if the server is reachable on the specified port. ```bash telnet imap.example.com 993 ``` -------------------------------- ### Run imap:watch command in production Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/WatchMailbox-Command.md Executes the watch command using IDLE or polling methods to monitor specific mailboxes. ```bash # Watch the support mailbox using IDLE with full message content php artisan imap:watch support "Support Inbox" \ --method=idle \ --with=body,headers,flags \ --timeout=60 \ --attempts=10 # In a separate terminal, watch customer notifications php artisan imap:watch notifications "Notifications" \ --method=poll \ --timeout=5 ``` -------------------------------- ### Implement Graceful Degradation for Mailbox Connections Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/README.md Use a try-catch block to fall back to a secondary mailbox if the primary connection fails. ```php try { $mailbox = Imap::mailbox('primary'); } catch (InvalidArgumentException $e) { // Fall back to secondary mailbox $mailbox = Imap::mailbox('secondary'); } ``` -------------------------------- ### Configure cPanel Connection Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/configuration.md Set validate_cert to false if using self-signed certificates on shared hosting. ```php 'cpanel' => [ 'host' => 'mail.yourdomain.com', 'port' => 993, 'username' => 'user@yourdomain.com', 'password' => 'your-password', 'encryption' => 'ssl', 'validate_cert' => false, // Often needed for self-signed certs ] ``` -------------------------------- ### Implement TimeoutLoop Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Loop-Support.md Creates a loop that executes for a specific duration in seconds. ```php use DirectoryTree\ImapEngine\Laravel\Support\LoopInterface; class TimeoutLoop implements LoopInterface { public function __construct( private int $durationSeconds, ) {} public function run(callable $tick): void { $endTime = time() + $this->durationSeconds; while (time() < $endTime) { $tick(); } } } ``` -------------------------------- ### Basic Mailbox Usage Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/DOCUMENTATION_INDEX.md Retrieve a mailbox instance and fetch messages from the inbox. ```php // Get mailbox $mailbox = Imap::mailbox('default'); // Get inbox $inbox = $mailbox->inbox(); // Get messages $messages = $inbox->messages()->withBody()->all(); ``` -------------------------------- ### Define ImapServiceProvider class Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/ImapServiceProvider.md The primary class definition for the service provider, including registration and boot methods. ```php class ImapServiceProvider extends ServiceProvider { /** * Register application services. */ public function register(): void { $this->app->singleton(ImapManager::class, function () { return new ImapManager(config('imap', [])); }); $this->app->bind(LoopInterface::class, Loop::class); } /** * Bootstrap application services. */ public function boot(): void { if ($this->app->runningInConsole()) { $this->commands([ Commands\WatchMailbox::class, ]); } $this->publishes([ __DIR__.'/../config/imap.php' => config_path('imap.php'), ]); } } ``` -------------------------------- ### Triggering InvalidOptionException Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/errors.md Demonstrates the command execution that results in an InvalidOptionException when an unsupported watch method is provided. ```bash php artisan imap:watch default --method=invalid # throws InvalidOptionException: Invalid method [invalid] ``` -------------------------------- ### Imap::fake(string $name) Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Imap-Facade.md Creates a fake mailbox instance for testing purposes. ```APIDOC ## Imap::fake(string $name) ### Description Returns a fake implementation of the mailbox for use in unit and feature tests, allowing for message simulation and assertion. ### Parameters - **name** (string) - Required - The name of the mailbox configuration to fake. ### Usage Example ```php use DirectoryTree\ImapEngine\Laravel\Facades\Imap; $fake = Imap::fake('default'); $fake->receiveMessage($message); ``` ``` -------------------------------- ### Implement Mailbox Failure Alerting Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/errors.md Create a handler to notify administrators when mailbox watch attempts are exceeded. ```php use DirectoryTree\ImapEngine\Laravel\Events\MailboxWatchAttemptsExceeded; class AlertOnMailboxFailure { public function handle(MailboxWatchAttemptsExceeded $event): void { // Send alert to administrator Mail::to('admin@example.com')->send( new MailboxFailureAlert($event) ); } } ``` -------------------------------- ### Watch for new messages via Artisan Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/START_HERE.md Monitor a mailbox for new messages using the artisan command-line interface. ```bash php artisan imap:watch default --with=body,headers ``` -------------------------------- ### Track Loop Execution with LoopFake Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Loop-Support.md Use LoopFake to verify callback execution counts and event dispatching within a test case. ```php use DirectoryTree\ImapEngine\Laravel\Support\LoopFake; use Illuminate\Support\Facades\Event; public function test_message_received_event() { Event::fake(); $loop = new LoopFake(); $ticks = 0; $loop->run(function () use (&$ticks) { $ticks++; // Simulate message handling Event::dispatch(new MessageReceived($message, 'default')); }); $this->assertEquals(1, $ticks); Event::assertDispatched(MessageReceived::class); } ``` -------------------------------- ### Callable Type Implementations Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/types.md Various ways to provide callbacks for loop execution and event listeners. ```php // Anonymous function $loop->run(function () { // Handle message }); // Invokable class $loop->run(new HandleMessageReceived(...)); // Method reference (PHP 8.1+) $loop->run($handler->method(...)); // Static method $loop->run(MessageHandler::class . '::handle'); ``` -------------------------------- ### Swap Mailbox Instance Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/ImapManager.md Replaces a cached mailbox instance with a custom implementation, commonly used for injecting fakes during testing. ```php public function swap(string $name, MailboxInterface $mailbox): void ``` ```php use DirectoryTree\ImapEngine\Testing\FakeMailbox; $fake = new FakeMailbox(); $manager->swap('default', $fake); // Subsequent calls to mailbox('default') return the fake $mailbox = $manager->mailbox('default'); ``` -------------------------------- ### Monitor Laravel Logs Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/errors.md Use this command to tail the Laravel log file for IMAP-related errors and connection messages. ```bash tail -f storage/logs/laravel.log ``` -------------------------------- ### Access Mailbox via Facade Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/ImapServiceProvider.md Use the Imap facade to retrieve messages from a configured mailbox. ```php use DirectoryTree\ImapEngine\Laravel\Facades\Imap; $mailbox = Imap::mailbox('default'); $messages = $mailbox->inbox()->messages()->all(); ``` -------------------------------- ### mailbox(string $name): MailboxInterface Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/ImapManager.md Retrieves a mailbox instance by name, creating it if necessary. Subsequent calls return the cached instance. ```APIDOC ## mailbox(string $name) ### Description Retrieves a MailboxInterface instance for the specified mailbox name. The first call for a given mailbox name will build and cache the instance; subsequent calls return the cached instance from memory. ### Parameters - **name** (string) - Required - The name of the mailbox to retrieve ### Returns - **MailboxInterface** - The mailbox instance ### Throws - **InvalidArgumentException** - When the mailbox name is not defined in configuration ``` -------------------------------- ### Configure IMAP mailboxes in Laravel Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/README.md Define mailbox connection settings within the config/imap.php file using environment variables. ```php 'mailboxes' => [ 'default' => [ 'host' => env('IMAP_HOST'), 'port' => env('IMAP_PORT', 993), 'username' => env('IMAP_USERNAME'), 'password' => env('IMAP_PASSWORD'), 'encryption' => env('IMAP_ENCRYPTION', 'ssl'), 'timeout' => env('IMAP_TIMEOUT', 30), 'debug' => env('IMAP_DEBUG', false), 'validate_cert' => env('IMAP_VALIDATE_CERT', true), 'authentication' => env('IMAP_AUTHENTICATION', 'plain'), 'proxy' => [ 'socket' => env('IMAP_PROXY_SOCKET'), 'username' => env('IMAP_PROXY_USERNAME'), 'password' => env('IMAP_PROXY_PASSWORD'), 'request_fulluri' => env('IMAP_PROXY_REQUEST_FULLURI', false), ], ], ] ``` -------------------------------- ### Execute Retry Logic with Exponential Backoff Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/README.md Implement a loop to retry connection attempts with increasing sleep intervals. ```php $attempts = 0; $maxAttempts = 5; while ($attempts < $maxAttempts) { try { // Connect and process break; } catch (Exception $e) { $attempts++; sleep(2 ** $attempts); // Exponential backoff } } ``` -------------------------------- ### Configure Gmail Connection Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/configuration.md Use an App Password for Gmail authentication. ```php 'gmail' => [ 'host' => 'imap.gmail.com', 'port' => 993, 'username' => 'your-email@gmail.com', 'password' => 'your-app-specific-password', 'encryption' => 'ssl', 'authentication' => 'plain', ] ``` -------------------------------- ### Configure Office 365 Connection Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/configuration.md Standard configuration for Outlook/Office 365 mailboxes. ```php 'office365' => [ 'host' => 'outlook.office365.com', 'port' => 993, 'username' => 'your-email@company.com', 'password' => 'your-password', 'encryption' => 'ssl', 'authentication' => 'plain', ] ``` -------------------------------- ### Test with Fakes Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/Imap-Facade.md Utilizes the Imap facade's fake method to simulate mailbox interactions during unit testing. ```php use DirectoryTree\ImapEngine\Laravel\Facades\Imap; use Illuminate\Foundation\Testing\TestCase as BaseTestCase; class MailProcessingTest extends BaseTestCase { public function test_processes_incoming_messages() { $fake = Imap::fake('default'); // Simulate receiving a message $fake->receiveMessage($message); // Run application code $this->post('/process-mail', []); // Assert the message was processed $this->assertEquals(1, $fake->getProcessedMessageCount()); } } ``` -------------------------------- ### Imap::fake Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/types.md Creates a test double implementation of the MailboxInterface to simulate IMAP server interactions without requiring a live connection. ```APIDOC ## Imap::fake ### Description Creates a fake mailbox instance for testing purposes. This allows simulation of messages and folders within a test environment. ### Signature `Imap::fake(string $mailbox, array $config, array $folders, array $capabilities)` ### Parameters - **$mailbox** (string) - The name of the mailbox. - **$config** (array) - Configuration settings for the fake mailbox. - **$folders** (array) - List of folders to initialize. - **$capabilities** (array) - IMAP capabilities to simulate. ``` -------------------------------- ### Listen for MessageReceived events Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/START_HERE.md Register a listener to process incoming messages when the MessageReceived event is fired. ```php use DirectoryTree\ImapEngine\Laravel\Events\MessageReceived; Event::listen(MessageReceived::class, function ($event) { // Process $event->message }); ``` -------------------------------- ### Configure ImapManager mailboxes Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/api-reference/ImapManager.md Define the mailboxes array with connection details including host, port, and authentication settings. ```php [ 'mailboxes' => [ 'default' => [ 'host' => 'imap.example.com', 'port' => 993, 'username' => 'user@example.com', 'password' => 'password', 'encryption' => 'ssl', 'timeout' => 30, 'validate_cert' => true, 'authentication' => 'plain', ], ], ] ``` -------------------------------- ### Define Namespace Source: https://github.com/directorytree/imapengine-laravel/blob/master/_autodocs/DOCUMENTATION_INDEX.md The primary namespace for the package classes. ```text DirectoryTree\ImapEngine\Laravel ```