Implement user authentication in PHP API library