ClientOptions
Typed configuration object for {@see \oihana\arango\clients\ArangoClient}.
Replaces the legacy ArrayAccess-based options bag with PHP 8.4 named
parameters and read-only properties. Construct directly when the values
are known at compile time, or use fromArray() to map a free-form
configuration array (typically loaded from a TOML file).
Recognised array keys (mirror of the project's [arango] TOML section):
database(string) — target database nameendpoint(string) — single endpoint URL, e.g.tcp://127.0.0.1:8529endpoints(array) — ordered list of endpoints (failover); takes precedence over endpointauthType(string) — one of AuthType; defaults to AuthType::BASICtype(string) — legacy alias ofauthType(TOML compatibility)user(string) — basic auth userpassword(string) — basic auth passwordtoken(string) — JWT token (used whenauthType = "JWT")connection(string) — one of ConnectionMode; defaults to ConnectionMode::KEEP_ALIVEtimeout(int|float) — request timeout in seconds, legacy single knob (alias ofrequestTimeoutwhen the latter is absent)connectTimeout(int|float) — TCP / TLS handshake timeout in seconds (Guzzleconnect_timeout)requestTimeout(int|float) — full-request timeout in seconds (Guzzletimeout); falls back totimeoutwhen omittedmaxRuntime(int|float|null) — server-side max runtime per query in seconds (null = unlimited)batchSize(int) — default cursor batch sizeallowDirtyRead(bool) — opt into dirty reads (cluster only); makes the transport stampx-arango-allow-dirty-read: trueon every outbound requestreconnect(bool) — auto-reconnect when a keep-alive connection has timed out on the servercreate(bool) — auto-create collections on insert when missingdebug(bool) — enable verbose error logging
Unknown keys are silently ignored.
Tags
Table of Contents
Constants
- ALLOW_DIRTY_READ : string = 'allowDirtyRead'
- Array key — opt into dirty reads on a cluster deployment (`x-arango-allow-dirty-read: true` header on every request).
- AUTH_TYPE : string = 'authType'
- Array key — authentication scheme; expected value is one of {@see AuthType}.
- BATCH_SIZE : string = 'batchSize'
- Array key — default cursor batch size (int).
- CONNECT_TIMEOUT : string = 'connectTimeout'
- Array key — TCP / TLS handshake timeout in seconds.
- CONNECTION : string = 'connection'
- Array key — HTTP connection persistence mode; one of {@see ConnectionMode}.
- CREATE : string = 'create'
- Array key — when true, auto-create collections on insert if missing.
- DATABASE : string = 'database'
- Array key — target database name.
- DEBUG : string = 'debug'
- Array key — enable verbose error logging.
- DEFAULT_BATCH_SIZE : int = 1000
- Built-in default for {@see $batchSize} when none is provided.
- DEFAULT_CONNECT_TIMEOUT : int = 5
- Built-in default for {@see $connectTimeout} (in seconds) when none is provided. Matches Guzzle's own default and arangojs's `agentOptions` connect window.
- DEFAULT_TIMEOUT : int = 30
- Built-in default for {@see $timeout} (in seconds) when none is provided.
- ENDPOINT : string = 'endpoint'
- Array key — single endpoint URL (for example `tcp://127.0.0.1:8529`).
- ENDPOINTS : string = 'endpoints'
- Array key — ordered list of endpoints for cluster failover; takes precedence over {@see ENDPOINT}.
- MAX_RUNTIME : string = 'maxRuntime'
- Array key — server-side max runtime per query, in seconds (null = unlimited).
- PASSWORD : string = 'password'
- Array key — basic auth password (when authType = BASIC).
- RECONNECT : string = 'reconnect'
- Array key — auto-reconnect when a keep-alive connection has timed out on the server.
- REQUEST_TIMEOUT : string = 'requestTimeout'
- Array key — full-request timeout in seconds (Guzzle `timeout`).
- TIMEOUT : string = 'timeout'
- Array key — legacy single-knob timeout in seconds. Aliases {@see REQUEST_TIMEOUT} when the latter is omitted.
- TOKEN : string = 'token'
- Array key — JWT token (when authType = JWT).
- TYPE : string = 'type'
- Array key — legacy alias of {@see AUTH_TYPE} kept for TOML backwards compatibility.
- USER : string = 'user'
- Array key — basic auth user (when authType = BASIC).
Properties
- $allowDirtyRead : bool
- $authType : string
- $batchSize : int
- $connection : string
- $connectTimeout : int|float
- $create : bool
- $database : string|null
- $debug : bool
- $endpoints : array<string|int, mixed>
- $maxRuntime : int|float|null
- $password : string|null
- $reconnect : bool
- $requestTimeout : int|float
- Full-request timeout in seconds (Guzzle `timeout`). When the caller did not pass `requestTimeout` to the constructor, this value mirrors {@see $timeout} so the legacy single-knob configuration keeps working unchanged.
- $timeout : int|float
- $token : string|null
- $user : string|null
Methods
- __construct() : mixed
- endpoint() : string|null
- Returns the preferred endpoint (first entry of {@see $endpoints}) or null when none is configured.
- fromArray() : self
- Builds a ClientOptions instance from a free-form configuration array (typically the `[arango]` section of a TOML file).
Constants
ALLOW_DIRTY_READ
Array key — opt into dirty reads on a cluster deployment (`x-arango-allow-dirty-read: true` header on every request).
public
string
ALLOW_DIRTY_READ
= 'allowDirtyRead'
AUTH_TYPE
Array key — authentication scheme; expected value is one of {@see AuthType}.
public
string
AUTH_TYPE
= 'authType'
BATCH_SIZE
Array key — default cursor batch size (int).
public
string
BATCH_SIZE
= 'batchSize'
CONNECT_TIMEOUT
Array key — TCP / TLS handshake timeout in seconds.
public
string
CONNECT_TIMEOUT
= 'connectTimeout'
CONNECTION
Array key — HTTP connection persistence mode; one of {@see ConnectionMode}.
public
string
CONNECTION
= 'connection'
CREATE
Array key — when true, auto-create collections on insert if missing.
public
string
CREATE
= 'create'
DATABASE
Array key — target database name.
public
string
DATABASE
= 'database'
DEBUG
Array key — enable verbose error logging.
public
string
DEBUG
= 'debug'
DEFAULT_BATCH_SIZE
Built-in default for {@see $batchSize} when none is provided.
public
int
DEFAULT_BATCH_SIZE
= 1000
DEFAULT_CONNECT_TIMEOUT
Built-in default for {@see $connectTimeout} (in seconds) when none is provided. Matches Guzzle's own default and arangojs's `agentOptions` connect window.
public
int
DEFAULT_CONNECT_TIMEOUT
= 5
DEFAULT_TIMEOUT
Built-in default for {@see $timeout} (in seconds) when none is provided.
public
int
DEFAULT_TIMEOUT
= 30
ENDPOINT
Array key — single endpoint URL (for example `tcp://127.0.0.1:8529`).
public
string
ENDPOINT
= 'endpoint'
ENDPOINTS
Array key — ordered list of endpoints for cluster failover; takes precedence over {@see ENDPOINT}.
public
string
ENDPOINTS
= 'endpoints'
MAX_RUNTIME
Array key — server-side max runtime per query, in seconds (null = unlimited).
public
string
MAX_RUNTIME
= 'maxRuntime'
PASSWORD
Array key — basic auth password (when authType = BASIC).
public
string
PASSWORD
= 'password'
RECONNECT
Array key — auto-reconnect when a keep-alive connection has timed out on the server.
public
string
RECONNECT
= 'reconnect'
REQUEST_TIMEOUT
Array key — full-request timeout in seconds (Guzzle `timeout`).
public
string
REQUEST_TIMEOUT
= 'requestTimeout'
Falls back to TIMEOUT when absent.
TIMEOUT
Array key — legacy single-knob timeout in seconds. Aliases {@see REQUEST_TIMEOUT} when the latter is omitted.
public
string
TIMEOUT
= 'timeout'
TOKEN
Array key — JWT token (when authType = JWT).
public
string
TOKEN
= 'token'
TYPE
Array key — legacy alias of {@see AUTH_TYPE} kept for TOML backwards compatibility.
public
string
TYPE
= 'type'
USER
Array key — basic auth user (when authType = BASIC).
public
string
USER
= 'user'
Properties
$allowDirtyRead read-only
public
bool
$allowDirtyRead
= false
$authType read-only
public
string
$authType
= AuthType::BASIC
$batchSize read-only
public
int
$batchSize
= self::DEFAULT_BATCH_SIZE
$connection read-only
public
string
$connection
= ConnectionMode::KEEP_ALIVE
$connectTimeout read-only
public
int|float
$connectTimeout
= self::DEFAULT_CONNECT_TIMEOUT
$create read-only
public
bool
$create
= true
$database read-only
public
string|null
$database
= null
$debug read-only
public
bool
$debug
= false
$endpoints read-only
public
array<string|int, mixed>
$endpoints
= []
$maxRuntime read-only
public
int|float|null
$maxRuntime
= null
$password read-only
public
string|null
$password
= null
$reconnect read-only
public
bool
$reconnect
= true
$requestTimeout read-only
Full-request timeout in seconds (Guzzle `timeout`). When the caller did not pass `requestTimeout` to the constructor, this value mirrors {@see $timeout} so the legacy single-knob configuration keeps working unchanged.
public
int|float
$requestTimeout
$timeout read-only
public
int|float
$timeout
= self::DEFAULT_TIMEOUT
$token read-only
public
string|null
$token
= null
$user read-only
public
string|null
$user
= null
Methods
__construct()
public
__construct([string|null $database = null ][, array<string|int, string> $endpoints = [] ][, string $authType = AuthType::BASIC ][, string|null $user = null ][, string|null $password = null ][, string|null $token = null ][, string $connection = ConnectionMode::KEEP_ALIVE ][, int|float $timeout = self::DEFAULT_TIMEOUT ][, int|float $connectTimeout = self::DEFAULT_CONNECT_TIMEOUT ][, int|float|null $requestTimeout = null ][, int|float|null $maxRuntime = null ][, int $batchSize = self::DEFAULT_BATCH_SIZE ][, bool $allowDirtyRead = false ][, bool $reconnect = true ][, bool $create = true ][, bool $debug = false ]) : mixed
Parameters
- $database : string|null = null
-
Target database name.
- $endpoints : array<string|int, string> = []
-
Ordered list of server endpoints (first one preferred; the rest are failover candidates).
- $authType : string = AuthType::BASIC
-
Authentication scheme — one of AuthType.
- $user : string|null = null
-
Basic auth user (when authType = BASIC).
- $password : string|null = null
-
Basic auth password (when authType = BASIC).
- $token : string|null = null
-
JWT token (when authType = JWT).
- $connection : string = ConnectionMode::KEEP_ALIVE
-
HTTP connection persistence — one of ConnectionMode.
- $timeout : int|float = self::DEFAULT_TIMEOUT
-
Legacy single-knob timeout in seconds. Aliases $requestTimeout when the latter is omitted, so existing callers keep their semantics.
- $connectTimeout : int|float = self::DEFAULT_CONNECT_TIMEOUT
-
TCP / TLS handshake timeout in seconds (Guzzle
connect_timeout). - $requestTimeout : int|float|null = null
-
Full-request timeout in seconds (Guzzle
timeout). When omitted, falls back to$timeoutso a single-knob configuration keeps working unchanged. - $maxRuntime : int|float|null = null
-
Server-side max runtime per query, in seconds (null = unlimited).
- $batchSize : int = self::DEFAULT_BATCH_SIZE
-
Default cursor batch size.
- $allowDirtyRead : bool = false
-
Opt into ArangoDB dirty reads (cluster only). When true, the transport stamps every request with the
x-arango-allow-dirty-read: trueheader so reads can be served by any follower. Has no effect on single-server deployments — the server silently ignores the header. - $reconnect : bool = true
-
Auto-reconnect when a keep-alive connection has timed out on the server.
- $create : bool = true
-
Auto-create collections on insert when missing.
- $debug : bool = false
-
Enable verbose error logging.
endpoint()
Returns the preferred endpoint (first entry of {@see $endpoints}) or null when none is configured.
public
endpoint() : string|null
Return values
string|nullfromArray()
Builds a ClientOptions instance from a free-form configuration array (typically the `[arango]` section of a TOML file).
public
static fromArray(array<string, mixed> $config) : self
Both endpoint (single string) and endpoints (array of strings) are
recognised; when both are present, endpoints wins and endpoint is
prepended only when not already in the list.
For backwards compatibility with the legacy TOML schema, the alias key
type is accepted as a synonym for authType.
Parameters
- $config : array<string, mixed>