# PHP Login setup

**URL:** <https://www.patreondevelopers.com/t/php-login-setup/2129>\
**Category:** Friendly Help\
**Created:** [August 13, 2019, 1:25am UTC](https://www.patreondevelopers.com/t/php-login-setup/2129 "2019-08-13T01:25:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RichyCapy](https://avatars.discourse-cdn.com/v4/letter/r/ea666f/32.png) [@RichyCapy](https://www.patreondevelopers.com/u/RichyCapy)\
**Post date:** [August 13, 2019, 1:25am UTC](https://www.patreondevelopers.com/t/php-login-setup/2129/1 "2019-08-13T01:25:13Z")

</div>

Hi, how are you all?

Im new using Patreon as a Login method

And using some examples, I was able to create the login… however, I can’t use the information sent back by Patreon,

Im getting this:  
Art4\JsonApiClient\Document Object  
(  
[container:protected] =\> Art4\JsonApiClient\Utils\DataContainer Object  
(  
[allowed\_keys:protected] =\> Array  
(  
)

```
        [data:protected] => Array
            (
                [data] => Patreon\JSONAPI\ResourceItem Object
                    (
                        [resource_item:protected] => Art4\JsonApiClient\ResourceItem Object
                            (
                                [container:protected] => Art4\JsonApiClient\Utils\DataContainer Object
                                    (
                                        [allowed_keys:protected] => Array
                                            (
                                            )

                                        [data:protected] => Array
                                            (
                                                [type] => user
                                                [id] => 12345678
                                                [attributes] => Art4\JsonApiClient\Attributes Object
                                                    (
                                                        [container:protected] => Art4\JsonApiClient\Utils\DataContainer Object
                                                            (
                                                                [allowed_keys:protected] => Array
                                                                    (
                                                                    )

                                                                [data:protected] => Array
                                                                    (
                                                                        [about] => 
                                                                        [can_see_nsfw] => 1
                                                                        [created] => 2019-05-19T23:28:09.000+00:00
                                                                        [default_country_code] => 
                                                                        [discord_id] => 

```

So, what I want to get is the name, the icon, not sure if I need the email… but, and most importantly… if the user has an active pledge on my patreon account, so I can give access to different type of information depending on his current tier.

Y try doing this:  
$patron\_response = $api\_client-\>fetch\_user();  
$first\_name = $patron\_response[‘data’][‘attributes’][‘first\_name’];  
$last\_name = $patron\_response[‘data’][‘attributes’][‘last\_name’];  
$full\_name = $patron\_response[‘data’][‘attributes’][‘full\_name’];   
echo $first\_name;

But got this error:  
Fatal error: Uncaught Error: Cannot use object of type Art4\JsonApiClient\Document as array in /var/mysite.com/patreon/index.php:53  
Stack trace:  
#0 {main}  
thrown in /var/mysite.com/patreon/index.php on line 53

Can some one help? 😄

---

<div class="post-metadata">

**Author:** ![danilluzin](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/danilluzin/32/1078_2.png) [@danilluzin](https://www.patreondevelopers.com/u/danilluzin)\
**Post date:** [October 10, 2019, 12:53pm UTC](https://www.patreondevelopers.com/t/php-login-setup/2129/3 "2019-10-10T12:53:01Z")

</div>

Hi I know this is several month old, but since there is no real tech support to speak of here, I will answer in case someone stumbles upon this thread with the same issue.

Basically **don’t use composer to get your package**.

It is very outdated compared to the one on github.  
I recently faced the exact same issue and even reported it on github

> <https://github.com/Patreon/patreon-php/issues/73>
>
> fetch\_user returns Art4\\JsonApiClient\\Document object instead of array by default even if it is explicitly asked to return array:
> $api\_client-\>api\_return\_format = 'array';
> example...

They since updated readme on git to reflect that fact.
