I needed this feature as well, so I forked the Winglian Buildpack, added imap support and cleaned some things up. The buildpack is available here, feel free to try it out ;) https://github.com/mattiasottosson/heroku-buildpack-php
Demo app just showing php-config: php-imap.herokuapp.com