Skip to main content
NexusConfig is a constructor-promoted value object holding every setting required to build a client. Pass it to NexusClient::create.

Field reference

Validation

Every option is resolved and validated when NexusConfig is constructed, and an invalid one is rejected naming the option, the value, and - for the reconnect schedule - the array index:
Coercing a bad value into a working one hides the mistake: it resurfaces days later as unexplained load or a stalled stream, with nothing pointing at the cause. An unusable value is rejected at construction, naming the option, the value and the array index, rather than being adjusted to something that works.

API key types

Calling getSecret(...) or getSecretFilePath(...) with a public key throws NexusPublicKeyException before any network call is made.

Where to keep the API key

Use environment variables - never hardcode the key in source:
In Laravel or Symfony, use the application’s config system:
The SDK never logs the raw key. Log lines reference the key type only:

Choosing the TTL

The TTL controls how long the in-memory cache is considered fresh before a background sync is triggered. With SSE enabled (connectStream()), changes propagate within milliseconds regardless of the TTL - the TTL only matters as a fallback when the stream is not running (FPM request handlers, for example).
In PHP-FPM, each request creates a fresh PHP process, so the cache is always empty at the start of a request and the TTL has no staleness effect across requests. The TTL is relevant only for long-running CLI daemons and queue workers.

Custom HTTP client

The factory accepts a PSR-18 client as its second argument, so the stack your application already configures - its timeouts, CA bundle, proxy, middleware and instrumentation - is what talks to Nexus:
Any PSR-18 implementation works - Guzzle above, Symfony HttpClient, or your own. Pass nothing and the SDK discovers whichever one the project has installed. See HTTP client.
Do not set a timeout that is too short - the initial sync is blocking and must complete before create returns. 10 seconds is a sensible minimum.

WifConfig overview

When you pass a WifConfig to NexusConfig::$wif, the SDK skips the static apiKey on every request and instead exchanges a workload OIDC token for a Nexus session JWT:
See Workload identity for the full provider table, the WifCredentialSource extension point, and token exchange details.