Attribute Converters


Attribute converters are responsible for converting data from LDAP to the format you want it as in PHP, and vice-versa. Several attribute converters are built-in and exist under the \LdapTools\AttributeConverter namespace. All attribute converters have the methods toLdap($value) and fromLdap($value) that you can use to convert your data to the correct form. Typically this is done automatically from the schema definition, but you can also use them on their own as long as they don't have a dependency on the LdapConnection to make the data conversion.

use LdapTools\Factory\AttributeConvertFactory;

// will return the string form of an objectGuid binary value.
$guid = AttributeConverterFactory::get('windows_guid')->fromLdap($value)

The AttributeConverterInterface requires a method called setLdapConnection. This is called during the data hydration process and the converter may use the connection to make LDAP calls to resolve data as necessary.

Default Attribute Converters


bool

int

enum

flags

generalized_time

password_must_change

windows_account_name

windows_generalized_time

windows_guid

windows_sid

windows_time

windows_security

encode_windows_password

exchange_proxy_address

exchange_object_version

exchange_legacy_dn

exchange_recipient_policy

logon_workstations

account_expires

group_type

value_to_dn

primary_group

functional_level

gpoptions

exchange_roles

exchange_version

ldap_type