[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/php-ai-client/src/Providers/ -> ProviderRegistry.php (summary)

(no description)

File Size: 520 lines (24 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

ProviderRegistry:: (20 methods):
  registerProvider()
  getRegisteredProviderIds()
  hasProvider()
  getProviderClassName()
  getProviderId()
  isProviderConfigured()
  findModelsMetadataForSupport()
  findProviderModelsMetadataForSupport()
  getProviderModel()
  bindModelDependencies()
  resolveProviderClassName()
  setHttpTransporter()
  setProviderRequestAuthentication()
  getProviderRequestAuthentication()
  setHttpTransporterForProvider()
  setRequestAuthenticationForProvider()
  createDefaultProviderRequestAuthentication()
  isRegisteredClassName()
  isRegisteredId()
  getEnvVarName()


Class: ProviderRegistry  - X-Ref

Registry for managing AI providers and their models.

This class provides a centralized way to register AI providers, discover
their capabilities, and find suitable models based on requirements.

registerProvider(string $className)   X-Ref
Registers a provider class with the registry.

param: class-string<ProviderInterface> $className The fully qualified provider class name implementing the

getRegisteredProviderIds()   X-Ref
Gets a list of all registered provider IDs.

return: list<string> List of registered provider IDs.

hasProvider(string $idOrClassName)   X-Ref
Checks if a provider is registered.

return: bool True if the provider is registered.
param: string|class-string<ProviderInterface> $idOrClassName The provider ID or class name to check.

getProviderClassName(string $idOrClassName)   X-Ref
Gets the class name for a registered provider.

return: class-string<ProviderInterface> The provider class name.
param: string|class-string<ProviderInterface> $idOrClassName The provider ID or class name.

getProviderId(string $idOrClassName)   X-Ref
Gets the provider ID for a registered provider.

return: string The provider ID.
param: string|class-string<ProviderInterface> $idOrClassName The provider ID or class name.

isProviderConfigured(string $idOrClassName)   X-Ref
Checks if a provider is properly configured.

return: bool True if the provider is configured and ready to use.
param: string|class-string<ProviderInterface> $idOrClassName The provider ID or class name.

findModelsMetadataForSupport(ModelRequirements $modelRequirements)   X-Ref
Finds models across all available providers that support the given requirements.

return: list<ProviderModelsMetadata> List of provider models metadata that match requirements.
param: ModelRequirements $modelRequirements The requirements to match against.

findProviderModelsMetadataForSupport(string $idOrClassName, ModelRequirements $modelRequirements)   X-Ref
Finds models within a specific available provider that support the given requirements.

return: list<ModelMetadata> List of model metadata that match requirements.
param: string $idOrClassName The provider ID or class name.
param: ModelRequirements $modelRequirements The requirements to match against.

getProviderModel(string $idOrClassName, string $modelId, ?ModelConfig $modelConfig = null)   X-Ref
Gets a configured model instance from a provider.

return: ModelInterface The configured model instance.
param: string|class-string<ProviderInterface> $idOrClassName The provider ID or class name.
param: string $modelId The model identifier.
param: ModelConfig|null $modelConfig The model configuration.

bindModelDependencies(ModelInterface $modelInstance)   X-Ref
Binds dependencies to a model instance.

This method injects required dependencies such as HTTP transporter
and authentication into model instances that need them.

return: void
param: ModelInterface $modelInstance The model instance to bind dependencies to.

resolveProviderClassName(string $idOrClassName)   X-Ref
Gets the class name for a registered provider (handles both ID and class name input).

return: class-string<ProviderInterface> The provider class name.
param: string|class-string<ProviderInterface> $idOrClassName The provider ID or class name.

setHttpTransporter(HttpTransporterInterface $httpTransporter)   X-Ref
{@inheritDoc}


setProviderRequestAuthentication(string $idOrClassName, RequestAuthenticationInterface $requestAuthentication)   X-Ref
Sets the request authentication instance for the given provider.

param: string|class-string<ProviderInterface> $idOrClassName The provider ID or class name.
param: RequestAuthenticationInterface $requestAuthentication The request authentication instance.

getProviderRequestAuthentication(string $idOrClassName)   X-Ref
Gets the request authentication instance for the given provider, if set.

return: ?RequestAuthenticationInterface The request authentication instance, or null if not set.
param: string|class-string<ProviderInterface> $idOrClassName The provider ID or class name.

setHttpTransporterForProvider(string $className, HttpTransporterInterface $httpTransporter)   X-Ref
Sets the HTTP transporter for a specific provider, hooking up its class instances.

param: class-string<ProviderInterface> $className The provider class name.
param: HttpTransporterInterface $httpTransporter The HTTP transporter instance.

setRequestAuthenticationForProvider(string $className, RequestAuthenticationInterface $requestAuthentication)   X-Ref
Sets the request authentication for a specific provider, hooking up its class instances.

param: class-string<ProviderInterface> $className The provider class name.
param: RequestAuthenticationInterface $requestAuthentication The authentication instance.

createDefaultProviderRequestAuthentication(string $className)   X-Ref
Creates a default request authentication instance for a provider.

return: ?RequestAuthenticationInterface The default request authentication instance, or null if not required or
param: class-string<ProviderInterface> $className The provider class name.

isRegisteredClassName(string $idOrClassName)   X-Ref
Checks if the given value is a registered provider class name.

return: bool True if it's a registered class name.
param: string $idOrClassName The value to check.

isRegisteredId(string $idOrClassName)   X-Ref
Checks if the given value is a registered provider ID.

return: bool True if it's a registered provider ID.
param: string $idOrClassName The value to check.

getEnvVarName(string $providerId, string $field)   X-Ref
Converts a provider ID and field name to a constant case environment variable name.

return: string The environment variable name in CONSTANT_CASE.
param: string $providerId The provider ID.
param: string $field The field name.



Generated : Sat Jun 13 09:38:55 2026 Cross-referenced by PHPXref