Skip to content
PHP Ecosystem
Explore

ServiceConnection

API reference › LDAP › ServiceConnection

final classyii2\extensions\ldap\ServiceConnection
ExtendsLdapRecord\Connection
Sourcesrc/ServiceConnection.php

Opens a service-account connection only after requiring and establishing verified StartTLS.

MethodDescriptionDefined by
auth()Creates a guard without sending service credentials to global authentication event listeners.ServiceConnection
connect()Establishes a bound session or fails outside the native query retry handler.ServiceConnection
initialize()Sets options on the specific LDAP handle, not on the process-wide defaults.ServiceConnection
query()Creates the native query builder with strict paged-result handling.ServiceConnection
public function auth(): LdapRecord\Auth\Guard

Creates a guard without sending service credentials to global authentication event listeners.

Returns

LdapRecord\Auth\Guard: Authentication guard for this connection.

Throws

public function connect(string|null $username = null, string|null $password = null): void

Establishes a bound session or fails outside the native query retry handler.

Parameters

ParameterTypeDescription
$usernamestring|nullExplicit bind name. When both arguments are null, uses the configured account.
$passwordstring|nullPassword corresponding to the explicit bind name.

Throws

public function initialize(): void

Sets options on the specific LDAP handle, not on the process-wide defaults.

Throws

public function query(): LdapRecord\Query\Builder

Creates the native query builder with strict paged-result handling.

Returns

LdapRecord\Query\Builder: Query builder configured with this connection’s base DN and cache.