I am accessing Gmail messages via IMAP using PHP. I'd like to know what label(s) each message is tagged with. Apparently Google has an IMAP extension that will do exactly what I need:
https://developers.google.com/google-apps/gmail/imap_extensions#access_to_gmail_labels_x-gm-labels
However, I'm not sure how to use this extension via PHP. There are PHP IMAP functions for fetch_header, etc., but I don't see a raw "fetch" that would let me grab this extension information. Any advice?