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 whenNexusConfig 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
Where to keep the API key
Use environment variables - never hardcode the key in source: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: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 aWifConfig to NexusConfig::$wif, the SDK skips the static apiKey on every request and instead exchanges a workload OIDC token for a Nexus session JWT:
WifCredentialSource extension point, and token exchange details.