PHP 5 has reached end of support and will be
deprecated
on January 31, 2026. After deprecation, you won't be able to deploy PHP 5
applications, even if your organization previously used an organization policy to
re-enable deployments of legacy runtimes. Your existing PHP
5 applications will continue to run and receive traffic after their
deprecation date. We recommend that
you
migrate to the latest supported version of PHP.
\google\appengine\api\users\User
Stay organized with collections
Save and categorize content based on your preferences.
FINAL
A user.
We provide the email address, nickname, and id for a user.
A nickname is a human-readable string which uniquely identifies a Google
user, akin to a username. It will be an email address for some users, but
not all.
A user could be a Google Accounts user or a federated login user.
Federated identity and federated provider are only avaliable for
federated users.
Methods
__construct
__construct(string $email = null, string $federated_identity = null, string $federated_provider = null, $user_id = null)
Constructor.
Parameters
Name |
Description |
$email
|
string
An optional string of the user's email address. It
defaults to the current user's email address. |
$federated_identity
|
string
The federated identity of user. It
defaults to the current user's federated identity. |
$federated_provider
|
string
The federated provider url of user. |
$user_id
|
|
Throws
\InvalidArgumentException
Thrown if both email and federated
identity are empty.
getNickname
getNickname() : string
Return this user's nickname.
The nickname will be a unique, human readable identifier for this user
with respect to this application. It will be an email address for some
users, part of the email address for some users, and the federated identity
for federated users who have not asserted an email address.
Returns
string
The user's nickname.
getEmail
getEmail() : string
Return this user's email address.
Returns
string
The user's email address.
getUserId
getUserId() : string
Return either a permanent unique identifying string or null.
If the email address was set explicity, this will return null.
Returns
string
The user's UserId.
getAuthDomain
getAuthDomain() : string
Return this user's auth domain.
This method is internal and should not be used by client applications.
Returns
string
The user's authentication domain.
getFederatedIdentity
getFederatedIdentity() : string
Return this user's federated identity, null if not a federated user.
Returns
string
The user's federated identity.
getFederatedProvider
getFederatedProvider() : string
Return this user's federated provider, null if not a federated user.
Returns
string
The user's federated provider.
__toString
__toString() : string
Magic method that PHP uses when the object is treated like a string.
Returns
string
The attributes of this user.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-16 UTC."],[[["\u003cp\u003eThis document details how to access information about a user, including their email, nickname, and unique ID.\u003c/p\u003e\n"],["\u003cp\u003eA user's nickname is a human-readable, unique identifier, which may or may not be their email address.\u003c/p\u003e\n"],["\u003cp\u003eUsers can be either Google Accounts users or federated login users, with federated users also having a federated identity and provider.\u003c/p\u003e\n"],["\u003cp\u003eMethods are provided to retrieve a user's email, nickname, unique ID, authentication domain, federated identity, and federated provider.\u003c/p\u003e\n"],["\u003cp\u003eThe constructor for a user can take an optional email, federated identity, federated provider and user id, but if both email and federated identity are empty an exception is thrown.\u003c/p\u003e\n"]]],[],null,["# \\google\\appengine\\api\\users\\User\n\nFINAL\n\nA user.\n\nWe provide the email address, nickname, and id for a user.\n\nA nickname is a human-readable string which uniquely identifies a Google\nuser, akin to a username. It will be an email address for some users, but\nnot all.\n\nA user could be a Google Accounts user or a federated login user.\n\nFederated identity and federated provider are only avaliable for\nfederated users.\n\nMethods\n-------\n\n### __construct\n\n`__construct(string `$email = null`, string `$federated_identity = null`, string `$federated_provider = null`, `$user_id = null`) `\n\nConstructor.\n\n#### Parameters\n\n#### Throws\n\n`\\InvalidArgumentException`\n\nThrown if both email and federated\nidentity are empty.\n\n### getNickname\n\n`getNickname() : string`\n\nReturn this user's nickname.\n\nThe nickname will be a unique, human readable identifier for this user\nwith respect to this application. It will be an email address for some\nusers, part of the email address for some users, and the federated identity\nfor federated users who have not asserted an email address.\n\n#### Returns\n\n`string`\n\nThe user's nickname.\n\n### getEmail\n\n`getEmail() : string`\n\nReturn this user's email address.\n\n#### Returns\n\n`string`\n\nThe user's email address.\n\n### getUserId\n\n`getUserId() : string`\n\nReturn either a permanent unique identifying string or null.\n\nIf the email address was set explicity, this will return null.\n\n#### Returns\n\n`string`\n\nThe user's UserId.\n\n### getAuthDomain\n\n`getAuthDomain() : string`\n\nReturn this user's auth domain.\n\nThis method is internal and should not be used by client applications.\n\n#### Returns\n\n`string`\n\nThe user's authentication domain.\n\n### getFederatedIdentity\n\n`getFederatedIdentity() : string`\n\nReturn this user's federated identity, null if not a federated user.\n\n#### Returns\n\n`string`\n\nThe user's federated identity.\n\n### getFederatedProvider\n\n`getFederatedProvider() : string`\n\nReturn this user's federated provider, null if not a federated user.\n\n#### Returns\n\n`string`\n\nThe user's federated provider.\n\n### __toString\n\n`__toString() : string`\n\nMagic method that PHP uses when the object is treated like a string.\n\n#### Returns\n\n`string`\n\nThe attributes of this user."]]