Ah, sounds like this is one that may need to be supplied with the bundled PHP services, if it can't be added afterwards. I'm more than happy to do that... IMAP is hardly obscure.
However, I'm not familiar with this requirement for special parameters at compile time. Indigo's PHPs are built from customised versions of those provided by by Shivam Mathur at https://github.com/shivammathur/homebrew-php and as such should work nicely with the extensions provided at https://github.com/shivammathur/homebrew-extensions. The IMAP extension provided there doesn't appear to need to be involved at PHP compile time?
I'll experiment, and if need be, recompile the PHPs with IMAP support, otherwise hopefully I will be able to just add this extension as I've done with the SSH extension etc.
If you need it sooner, I wonder if you can install it directly yourself from https://github.com/shivammathur/homebrew-extensions? No problem if you'd rather not do that though!