Adding users to nextcloud externally

Hello, I’ve got some questions about nextcloud using mysql. Firstly, how does it hash it’s passwords and to which table does it adds the newly created users? I want to make a php program that would add a user for me with a click of a button.