$user = Auth::user(); // get the authenticated user instance $name = $user->name; // get the user's name $email = $user->email; // get the user's email
$user = $this->getUser(); // get the authenticated user instance $name = $user->getUsername(); // get the user's name $email = $user->getEmail(); // get the user's email
$this->load->library('session'); $user = $this->session->userdata('user'); // get the user instance from session $name = $user['name']; // get the user's name $email = $user['email']; // get the user's emailIn these examples, the User instance is retrieved from the current session or authentication status and used to access the user's information. The packages used are Laravel, Symfony, and Codeigniter.