A client user.
The client is one of the most important records tracked by WHMCS. A client object models a single WHMCS customer. Clients can log into WHMCS's client area and can order services, create support tickets, or access all other functionality available in the client area. Their records contain contact information for the client, authentication and payment settings for the client, and other configuration options necessary for the client to properly use WHMCS.
Most objects stored in WHMCS are either directly related to a client or connected to a client through a client's related objects, such as invoices, orders, or quotes.
|int||$id||A client's unique id number.|
|string||$firstName||A client's first name.|
|string||$lastName||A client's last name.|
|string||$companyName||The name of the company employing a client.|
|string||A client's email address.|
|string||$address1||The first line of the address a client resides at.|
|string||$address2||The second line of the address a client resides at.|
|string||$city||The city a client resides in.|
|string||$state||The state or province a client resides in.|
|string||$postcode||The post or zip code a client resides in.|
|string||$country||The two-letter ISO code of the country a client resides in.|
|string||$phoneNumber||A client's phone number.|
|string||$passwordHash||A client's stored password hash.|
|string||$twoFactorAuthModule||The name of a client's two factor authentication module, if they are using one.|
|string||$twoFactorAuthData||A client's two-factor authentication module's internal data, stored as a PHP serialized string.|
|int||$currencyId||The id number of a client's preferred currency.|
|string||$defaultPaymentGateway||A client's default default payment gateway module.|
|float||$credit||The amount of credit a client has available.|
|bool||$taxExempt||Whether or not a client is exempt from paying taxes.|
|bool||$overrideLateFee||Whether or not a client should be charged late payment fees.|
|bool||$overrideOverdueNotices||Whether or not a client should receive overdue invoice notices.|
|bool||$separateInvoices||Whether or not a client should receive separate invoices for their purchased services.|
|bool||$disableAutomaticCreditCardProcessing||Whether or not a client's invoices should be automatically processed.|
|DateTime||$dateCreated||The date a client was created.|
|string||$notes||Internal admin-provided notes about a client. These notes are not visible to the client.|
|int||$billingContactId||The id number of a client's associated billing contact.|
|int||$securityQuestionId||The id number of a client's configured security question.|
|string||$securityQuestionAnswer||The encrypted answer to a client's configured security question.|
|string||$creditCardType||The type of credit card a client has on file.|
|string||$creditCardLastFourDigits||The last four digits of a client's credit card on file.|
|string||$creditCardExpiryDate||The encrypted expiration date of a client's card on file.|
|int||$groupId||The id number of the group that a client belongs to.|
|string||$storedBankNameCrypt||The encrypted name of a client's bank.|
|string||$storedBankTypeCrypt||A client's encrypted bank type.|
|string||$storedBankCodeCrypt||A client's encrypted bank code.|
|string||$storedBankAccountCrypt||A client's encrypted bank account number.|
|string||$paymentGatewayToken||A client's payment gateway token, if required by the payment gateway.|
|Carbon||$lastLoginDate||The last date a client logged into the client area.|
|string||$lastLoginIp||The IP address a client used the last time they logged into the client area.|
|string||$lastLoginHostname||The resolved hostname of the IP address used the last time a client logged into the client area.|
|string||$status||A client's status, either "Active", "Inactive", or "Closed".|
|string||$language||A client's preferred display language.|
|string||$passwordResetKey||The auto-generated key from a client's last password reset attempt.|
|Carbon||$passwordResetKeyRequestDate||The date that a client's most recent password reset key was generated.|
|bool||$emailOptOut||Whether or not to disable sending email to a client.|
|bool||$marketingEmailsOptIn||Has the client opted in to marketing emails.|
|bool||$overrideAutoClose||If true, do not automatically set this client's account status to 'Closed.'|
|bool||$allowSSO||Determines if Single Sign-On is permitted for this client user.|
|bool||$emailVerified||Determines if the client's email address ownership has been verified.|
|string||$fullName||A client's first name and last name.|
|string||$countryName||The full name of the country a client resides in.|
|Service||$services||The services a client has purchased.|
|Domain||$domains||The domains a client has purchased.|
|Contact||$contacts||A client's associated contacts.|
|Quote||$quotes||The quotes assigned to a client.|
|Affiliate||$affiliate||A client's affiliate record, if activated as an affiliate.|
|SecurityQuestion||$securityQuestion||The security question a client has chosen for authentication.|
|Currency||$currencyrel||A client's currency.|
|string||$username||A client's username (email).|
|Carbon||$updatedAt||Last update of the client data (or 0000-00-00 00:00:00 if no updated since 6.0.0).|
|Carbon||$createdAt||Initial creation of the client data (or 0000-00-00 00:00:00 if created before 6.0.0).|
|Return Type||Method Name||Description|
|HasMany||domains()||A client can have many domains.|
|HasMany||services()||A client can have many services.|
|HasMany||addons()||A client can have many add-on services.|
|HasMany||contacts()||A client can have many contacts.|
|HasMany||quotes()||A client can have many quotes for services.|
|HasOne||affiliate()||A client can have an associated affiliate record.|
|belongsTo||securityQuestion()||A client can have an associated security question.|
|HasMany||invoices()||A client can have many invoices.|
|HasMany||transactions()||A client can have many transactions.|
|HasMany||remoteAccountLinks()||A client can have many linked remote accounts.|
|HasMany||orders()||A client can have many orders.|
|Builder||scopeLoggedIn(Builder $query)||Apply filter for the currently authenticated user.|
|HasOne||currencyrel()||A client has an associated currency.|
|static string||getStatuses()||Get client status values.|
|bool||hasDomain(string $domainName)||Determines if client has a given domain name.|
|Collection|Alert||getAlerts(AlertFactory $factory = null)||Retrieve a client's alerts.|
|bool||isCreditCardExpiring(int $withinMonths = 2)||Determine if a user's credit card is going to expire within a number of months.|
|string||getFullNameAttribute()||"fullName" is the concatenation of first and last name.|
|string||getCountryNameAttribute()||Returns the human readable name for the clients country.|
|string||getSecurityQuestionAnswerAttribute(string $answer)||Decrypt security question answers from storage.|
|setSecurityQuestionAnswerAttribute(string $answer)||Encrypt security question answers for storage.|
|string||generateCreditCardEncryptedField(string $value)||Generate an AES Encrypted string from the passed value.|
|bool||hasSingleSignOnPermission()||Returns if the client has Single Sign-On Enabled for their account.|
|bool||isAllowedToAuthenticate()||Should the user be allowed to authenticate|
|bool||isEmailAddressVerified()||Returns if the client's email address ownership has been verified.|
|string||getEmailVerificationId()||Returns the email verification id to verify email ownership.|
|static string||generateEmailVerificationKey()||Returns a key used to verify ownership of an email account.|
|Client||sendEmailAddressVerification()||Sends the email address verification email to the client.|
|updateLastLogin(Carbon $time = null, $ip = null, $host = null)||-|
|bool||hasPermission(string|int $permission)||This fulfills the UserInterface|
|HasMany||tickets()||A client can have many tickets.|
|bool||isOptedInToMarketingEmails()||Determine if user is opted in to marketing emails.|
|Client||marketingEmailOptIn(string $userIp = '', bool $performCurrentSettingCheck = true)||Opt in to email marketing.|
|Client||marketingEmailOptOut(string $userIp = '', bool $performCurrentSettingCheck = true)||Opt out of email marketing.|
|Client||logActivity(string $message)||Log activity.|
|bool|null||deleteEntireClient()||Deletes a client and all associated data.|
A client can have many domains.
A client can have many services.
A client can have many add-on services.
A client can have many contacts.
A client can have many quotes for services.
A client can have an associated affiliate record.
A client can have an associated security question.
A client can have many invoices.
A client can have many transactions.
A client can have many linked remote accounts.
NB: this will not return remote auth links of contacts associated with the client.
A client can have many orders.
scopeLoggedIn (Builder $query)
Apply filter for the currently authenticated user.
A client has an associated currency.
currencyrel because the name
currency conflicts with field name.
Get client status values.
hasDomain (string $domainName)
Determines if client has a given domain name.
Checks for both domains associated to services as well as domain registrations.
getAlerts (AlertFactory $factory = null)
Retrieve a client's alerts.
isCreditCardExpiring (int $withinMonths = 2)
Determine if a user's credit card is going to expire within a number of months.
"fullName" is the concatenation of first and last name.
In classic WHMCS objects, we compute a field named "name" which combines the first and last name for convenience in templates.
Returns the human readable name for the clients country.
getSecurityQuestionAnswerAttribute (string $answer)
Decrypt security question answers from storage.
setSecurityQuestionAnswerAttribute (string $answer)
Encrypt security question answers for storage.
generateCreditCardEncryptedField (string $value)
Generate an AES Encrypted string from the passed value.
Returns if the client has Single Sign-On Enabled for their account.
Should the user be allowed to authenticate
Returns if the client's email address ownership has been verified.
Returns the email verification id to verify email ownership.
Generates a new email verification id and stores it by either updating the row or inserting the row. This prevents stale keys from being used after a request has been made.
Returns a key used to verify ownership of an email account.
Sends the email address verification email to the client.
updateLastLogin (Carbon $time = null, $ip = null, $host = null)
hasPermission (string|int $permission)
This fulfills the UserInterface
A client can have many tickets.
Determine if user is opted in to marketing emails.
marketingEmailOptIn (string $userIp = '', bool $performCurrentSettingCheck = true)
Opt in to email marketing.
marketingEmailOptOut (string $userIp = '', bool $performCurrentSettingCheck = true)
Opt out of email marketing.
logActivity (string $message)
Deletes a client and all associated data.