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

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 Guzzle client

The factory method accepts an optional Guzzle client as its second argument:
If no Guzzle client is provided, the SDK constructs one with a 10-second timeout.
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, custom tokenSource closure, and token exchange details.