You can create folders and subfolders using the Lists web service using the UpdateListItems method. The following example code takes a foldername argument and creates a folder in the root folder of the list. If you want to create a folder within another folder then just change the RootFolder attribute to the url of the folder. Hope this helped.
I am a fresher and want to use SharePoint 2013 with php. What I really want to do is create folders, sub-folders and write .xlsx files inside these folders and also want to read and download these files using php. can anyone help me? I only understand PHP and java-script.