在PHP中生成跨浏览器CSS3渐变

As an input I have:

  • two colors (be it in hex, rgb or rgba formats), as strings
  • a number between 0 and 360 or an angle, in other words

I have to generate a valid, crossbrowser, CSS3 gradients using those parameters. Like this.

The part with colors is easy, the big pain is the part with converting angle value in a valid direction for every prefix.

I've checked out amazingSurge/jquery-asGradient library already and it can do this sort of manipulations. But doing CSS generation on client side is not a option for me.

Is there some other PHP libraries that can deal with this?