How to deploy my slim rest api online?

That depends on the features you are looking for. Some hosting services like fortrabbit will take care of it for you via Git. Others like Beanstalk or DeployBot will handle SFTP (and other transfers) for you. Or you can do it manually via SFTP, or use something like rsync.