Creating sub sites using one main site, Like wordpres does : I have a project to do with a client he refused to do it by WordPress  

The idea is simple creating one main site which you can enter and purchase a cms for your hospital 

My question is how to make the main site creates  Sub-sites with a domain once customer purchased  ?

Is it possible to be done using raw php?

I dont want the code just suggest me something to read or to look for 


