App::getUser

Usage

?ArmorUserInterface App::getUser()

Description


Return Value

If authenticated will return an instance of the User class, which extends the [ArmorUser](https://github.com/apexpl/armor/blob/master/docs/armoruser.md) class. Otherwise if not authenticated, will return null.

Examples

Get User


if (!$user = $app->getUser()) { throw new Exception("You are not logged in"); } echo "Username: " . $user->getUsername() . "<br />\n"; echo "Name: " . $user->getFullName() . "<br />"; echo "E-Mail: " . $user->getEmail() . "\n";

See Also