Control with Homematic (like sonos php class)

hi, i plan to control music box on raspi 2 over my homecontrol homatic (play, pause, next, choice radio sender, play alarm mp3 between runing stream and resume when alarm file ends)

my question is:
wich technical options are possible?
or give it a php class ?
can i directly put in a json command or script

i ask you for your help?