I'm not sure that something like that exists. Terminal capabilities are stored in `/etc/terminfo`, `/lib/terminfo` and `/usr/share/terminfo` files. A lot of them are symlinks. You can set TERM and query number of colors supported by terminal by `tput colors`.

On my server it is over 2600 terminals. I think, just `/lib/terminfo` can be considered. The result of supported colors by all terminals is here: https://gist.github.com/milo/5571785.

Next way is to detect colors by PHP code on the fly. But terminfo is poorlly supported by PHP (AFAIK by Ncurses extension only). Or run `tput colors` command, but it is just an overhead for colors detection.