The public (or _publichtml) folder is the public frontend for a visitor. This could also be the _privatehtml folder, depending on your implementation.
It is not preferrable and secure to have the PHP server in the public folder as well. It is better to hide it behind the public eye. Let us assume that it is installed in a folder on the same level
as the _publichtml folder named _privateeye. In that folder the Slim PHP server and your application would be installed. This folder is NOT accessible for the public.
In the public folder you create another folder named api. This will be used to have an entry point for your "slim" api REST requests to the server.
When in production you have the following structure:
|- root |--- private_eye |----- slim-server |--- private_html |--- public_html |------ api |---------- index.php |------ index.html |------ dist