I'm not sure I fully understand your questions. If you're trying to authenticate a client as a given user, you need to generate an authentication token, place it in the page, and have the client call auth() with that token. See the docs here:
https://www.firebase.com/docs/security/custom-login.html
If you're merely trying to write some data into Firebase at the /users location from PHP, you can do so with the REST API: