I would like for example to remove php and all it's components and extensions as seen in this picture, but instead of removing every software one by one, is there anyway safe I can remove them all using a single command? 
How to remove a (group) of softwares that depend on one another?
yum
Since you are in CentOS, you could use the yum as suggested here.yum remove $(yum list installed | grep php | cut -d' ' -f1 | tr \n  )