Documentation Index
Fetch the complete documentation index at: https://mintlify.com/phpaisdk/google/llms.txt
Use this file to discover all available pages before exploring further.
GoogleProvider is the concrete provider instance that sits between the static Google facade and the individual model classes. It extends BaseProvider from the core SDK contracts, holds an immutable GoogleOptions value object, and acts as a factory for GoogleTextModel and GoogleImageModel instances. In normal usage you never construct GoogleProvider directly — it is created and stored by Google::create().
Namespace
Constructor
GoogleOptions instance and stores it as a public read-only property. Because GoogleOptions is an immutable value object, a GoogleProvider instance is effectively immutable after construction.
A fully resolved
GoogleOptions value object containing the API key, base URL, custom headers, and optional HTTP client override. Normally created via GoogleOptions::fromArray() inside Google::create().You typically do not instantiate
GoogleProvider directly. Use Google::create() instead, which builds the GoogleOptions from a plain config array and stores the resulting provider as the package-wide default.Methods
name()
PROVIDER_NAME constant defined on GoogleOptions.
Returns string — always 'google'
textModel()
GoogleTextModel instance for the given model ID. The model is initialised with the provider’s GoogleOptions (containing authentication headers and the base URL) and the shared model registry inherited from BaseProvider.
The Gemini text model identifier, for example
'gemini-2.5-flash' or 'gemini-2.5-pro'.TextModelInterface (concretely GoogleTextModel)
Google::model('gemini-2.5-flash'), which delegates to this method on the default provider instance.
imageModel()
GoogleImageModel instance for the given model ID, initialised with the same GoogleOptions and model registry as textModel().
The Gemini image model identifier, for example
'gemini-2.0-flash-preview-image-generation'.ImageModelInterface (concretely GoogleImageModel)
Google::image('gemini-2.0-flash-preview-image-generation').
Direct Instantiation Example
WhileGoogle::create() is the recommended entry point, direct instantiation is occasionally useful — for example when you need multiple independent provider instances with different API keys in the same request lifecycle.