user

Instantiates a new User object.


user(id, content)

Arguments Type Description
id string Unique user identifier
content JSON Object User content

Return value

Returns the new User object.

Usage

Copied to clipboard!

<?php

use \Kuzzle\Kuzzle;
use \Kuzzle\Security\User;

$kuid = 'myUser';
$userDefinition = [
  // A "profileIds" field is required to bind a user to an existing profile
  'profileIds' => ['myProfile'],
  // The "local" authentication strategy requires a password
  'password' => 'secret',
  'firstname' => 'John',
  'lastname' => 'Doe'
];

$kuzzle = new Kuzzle('localhost');
$security = $kuzzle->security();

$user = $security->user($kuid, $userDefinition);
// $user instanceof User