Zitadel PHP API

Create
in package

Class to create a new user.

Table of Contents

Properties

$request  : array<string|int, mixed>
$settings  : array<string|int, mixed>

Methods

__construct()  : mixed
Initialize the user creation
addIDPLink()  : void
Add an Identity Provider to the User-Profile, so the user can sign in through e.g. Google or GitHub (optional). To get the required data to link an IDP, use the IDP class.
addMetaData()  : void
Add Metadata to the user Profile (optional). The value will be automatically Base64 encoded.
create()  : void
Create the new user and sends the data to Zitadel
setDisplayName()  : void
Set display name (optional)
setEmail()  : void
Set the Email address (required). The email address will automatically marked as verified.
setGender()  : void
Set the gender of the new user (optional)
setLanguage()  : void
Set the preferred user language (optional). If you don't set one, the default language will be used.
setName()  : void
Set the full name of the new user (required)
setNickName()  : void
Set the nickname (optional)
setOrganization()  : void
Set the organization membership of the new user
setPassword()  : void
Set a password for the new user account (required)
setPhone()  : void
Set the phone number (optional). The phone number will be automatically marked as verified.
setUserId()  : void
Set the user id of the new user (optional). If not set, you'll get one from Zitadel.
setUserName()  : void
Set the username of the new user. If you don't set one, the email address will be used as username.

Properties

$request

private array<string|int, mixed> $request

$settings

private array<string|int, mixed> $settings

Methods

__construct()

Initialize the user creation

public __construct(mixed $settings) : mixed
Parameters
$settings : mixed

array The settings array

Add an Identity Provider to the User-Profile, so the user can sign in through e.g. Google or GitHub (optional). To get the required data to link an IDP, use the IDP class.

public addIDPLink(mixed $idpId, mixed $userId, mixed $userName) : void
Parameters
$idpId : mixed

int The ID of the Identity Provider

$userId : mixed

string The user id you get from the Identity Provider

$userName : mixed

string The username you get from the Identity Provider

addMetaData()

Add Metadata to the user Profile (optional). The value will be automatically Base64 encoded.

public addMetaData(mixed $key, mixed $value) : void
Parameters
$key : mixed

string Key

$value : mixed

string Value

create()

Create the new user and sends the data to Zitadel

public create() : void
Tags
throws
Exception

Returns an exception with an error code and a message if the communication with Zitadel fails

setDisplayName()

Set display name (optional)

public setDisplayName(mixed $displayName) : void
Parameters
$displayName : mixed

string Display name

setEmail()

Set the Email address (required). The email address will automatically marked as verified.

public setEmail(string $email[, bool $isVerified = false ]) : void
Parameters
$email : string

Email address

$isVerified : bool = false

If the email address should be marked as verified. Default is "false"

setGender()

Set the gender of the new user (optional)

public setGender(mixed $gender) : void
Parameters
$gender : mixed

string Default: GENDER_UNSPECIFIED, Possible values: GENDER_MALE, GENDER_FEMALE, GENDER_DIVERSE

setLanguage()

Set the preferred user language (optional). If you don't set one, the default language will be used.

public setLanguage(mixed $lang) : void
Parameters
$lang : mixed

string Shortcode of the language, e.g. "en" or "de"

setName()

Set the full name of the new user (required)

public setName(mixed $givenName, mixed $familyName) : void
Parameters
$givenName : mixed

string Given Name

$familyName : mixed

string Family Name

setNickName()

Set the nickname (optional)

public setNickName(mixed $nickName) : void
Parameters
$nickName : mixed

string Nickname

setOrganization()

Set the organization membership of the new user

public setOrganization(mixed $orgId, mixed $orgDomain) : void
Parameters
$orgId : mixed

int Organization-Id

$orgDomain : mixed

string Organization-Domain

setPassword()

Set a password for the new user account (required)

public setPassword(mixed $password, mixed $changeRequired) : void
Parameters
$password : mixed

string The password

$changeRequired : mixed

bool If a change is required, the user have to set a new password at the next login.

setPhone()

Set the phone number (optional). The phone number will be automatically marked as verified.

public setPhone(string $phone[, bool $isVerified = false ]) : void
Parameters
$phone : string

Phone number in the format with county code, e.g. "+491590123456"

$isVerified : bool = false

If the phone number should be marked as verified. Default is "false"

setUserId()

Set the user id of the new user (optional). If not set, you'll get one from Zitadel.

public setUserId(mixed $userid) : void
Parameters
$userid : mixed

string The user id of the new user

setUserName()

Set the username of the new user. If you don't set one, the email address will be used as username.

public setUserName(mixed $username) : void
Parameters
$username : mixed

string The username of the new user


        
On this page

Search results