example of user_load in Drupal 8

Public

</> CopyGet raw version
php
  1. public function content() {
  2. $account = \Drupal\user\Entity\User::load('uid'); // pass your uid
  3. $name = $account->getUsername();
  4. drupal_set_message($name);
  5. }