How to use current user object in Drupal 8?
Yes you need to use a name space, you can include the name space directly like this

$user = \Drupal\user\Entity\User::load(\Drupal::currentUser()-&gt;id());
$name = $user-&gt;get('name')-&gt;value;