twilio / authy-php

A PHP client for Authy
245 stars 87 forks source link

how to obtain authy-id after creating a user #72

Closed lubwen closed 5 years ago

lubwen commented 5 years ago

Hi,

After I create a user using the API, e.g.: $user = $authy_api->registerUser('email', 'xxx-xxx-xxxx', '1');

How could I get the 'authy-id' from the return $user object?

The command print_r($user) shows that it is a 'protected' field so I guess there is a function like 'getID' or something to retrieve the 'authy-id'?

Authy\AuthyUser Object ( [raw_response:protected] => GuzzleHttp\Psr7\Response Object ( +-- 78 lines------------------------------------------------------- )

[body:protected] => stdClass Object
    (
        [id] => 15xxxxxx0
    )

[errors:protected] => stdClass Object
    (
    )

)

Please advise. Thanks. Best regards,

lubwen commented 5 years ago

I found the answer to my own question. Below is the function if anybody wants it: echo ( $user->bodyvar('id') );