I have an application in PHP 7, which works as follows:
Example
http://www.myapp.com.br/username
Each client has a username to configure and edit their information. When you enter this url, I make the query in the database and search for information according to the username of the url that is unique.
I wanted each client to have a domain of their own that would point to my site and become a domain.
Example:
http://www.myapp.com.br/empresaxyz -> www.empresaxyz.com.br