PHPackages                             wordpress/ai-provider-for-google - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. wordpress/ai-provider-for-google

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wordpress/ai-provider-for-google
================================

AI Provider for Google for the PHP AI Client SDK. Works as both a Composer package and WordPress plugin.

1.0.3(2mo ago)10142↑66.7%4[2 issues](https://github.com/WordPress/ai-provider-for-google/issues)GPL-2.0-or-laterPHPPHP &gt;=7.4CI passing

Since Feb 12Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/WordPress/ai-provider-for-google)[ Packagist](https://packagist.org/packages/wordpress/ai-provider-for-google)[ Docs](https://github.com/WordPress/ai-provider-for-google)[ RSS](/packages/wordpress-ai-provider-for-google/feed)WikiDiscussions trunk Synced 1mo ago

READMEChangelog (4)Dependencies (12)Versions (15)Used By (0)

AI Provider for Google
======================

[](#ai-provider-for-google)

A Google AI (Gemini) provider for the [PHP AI Client](https://github.com/WordPress/php-ai-client) SDK. Works as both a Composer package and a WordPress plugin.

Requirements
------------

[](#requirements)

- PHP 7.4 or higher
- When using with WordPress, requires WordPress 7.0 or higher
    - If using an older WordPress release, the [wordpress/php-ai-client](https://github.com/WordPress/php-ai-client) package must be installed

Installation
------------

[](#installation)

### As a Composer Package

[](#as-a-composer-package)

```
composer require wordpress/ai-provider-for-google
```

### As a WordPress Plugin

[](#as-a-wordpress-plugin)

1. Download the plugin files
2. Upload to `/wp-content/plugins/ai-provider-for-google/`
3. Ensure the PHP AI Client plugin is installed and activated
4. Activate the plugin through the WordPress admin

Usage
-----

[](#usage)

### With WordPress

[](#with-wordpress)

The provider automatically registers itself with the PHP AI Client on the `init` hook. Simply ensure both plugins are active and configure your API key:

```
// Set your Google API key (or use the GOOGLE_API_KEY environment variable)
putenv('GOOGLE_API_KEY=your-api-key');

// Use the provider
$result = AiClient::prompt('Hello, world!')
    ->usingProvider('google')
    ->generateTextResult();
```

### As a Standalone Package

[](#as-a-standalone-package)

```
use WordPress\AiClient\AiClient;
use WordPress\GoogleAiProvider\Provider\GoogleProvider;

// Register the provider
$registry = AiClient::defaultRegistry();
$registry->registerProvider(GoogleProvider::class);

// Set your API key
putenv('GOOGLE_API_KEY=your-api-key');

// Generate text
$result = AiClient::prompt('Explain quantum computing')
    ->usingProvider('google')
    ->generateTextResult();

echo $result->toText();
```

Supported Models
----------------

[](#supported-models)

Available models are dynamically discovered from the Google AI API. This includes Gemini models for text generation (with multimodal input support) and Imagen models for image generation. See the [Google AI documentation](https://ai.google.dev/gemini-api/docs/models) for the full list of available models.

Configuration
-------------

[](#configuration)

The provider uses the `GOOGLE_API_KEY` environment variable for authentication. You can set this in your environment or via PHP:

```
putenv('GOOGLE_API_KEY=your-api-key');
```

License
-------

[](#license)

GPL-2.0-or-later

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance83

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~10 days

Total

4

Last Release

64d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a60abe9a2c42fe5cf2117b88aac2eab186f0ea3c969f1f4a29d4a09d831153b8?d=identicon)[felixarntz](/maintainers/felixarntz)

---

Top Contributors

[![felixarntz](https://avatars.githubusercontent.com/u/3531426?v=4)](https://github.com/felixarntz "felixarntz (27 commits)")[![JasonTheAdams](https://avatars.githubusercontent.com/u/2024145?v=4)](https://github.com/JasonTheAdams "JasonTheAdams (9 commits)")[![jeffpaul](https://avatars.githubusercontent.com/u/2818133?v=4)](https://github.com/jeffpaul "jeffpaul (5 commits)")[![shaunandrews](https://avatars.githubusercontent.com/u/191598?v=4)](https://github.com/shaunandrews "shaunandrews (2 commits)")[![Jameswlepage](https://avatars.githubusercontent.com/u/36246732?v=4)](https://github.com/Jameswlepage "Jameswlepage (1 commits)")

---

Tags

wordpressgoogleaiGeminillm

###  Code Quality

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/wordpress-ai-provider-for-google/health.svg)

```
[![Health](https://phpackages.com/badges/wordpress-ai-provider-for-google/health.svg)](https://phpackages.com/packages/wordpress-ai-provider-for-google)
```

###  Alternatives

[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

310107.9k1](/packages/cognesy-instructor-php)[ardagnsrn/ollama-php

This is a PHP library for Ollama. Ollama is an open-source project that serves as a powerful and user-friendly platform for running LLMs on your local machine. It acts as a bridge between the complexities of LLM technology and the desire for an accessible and customizable AI experience.

20755.8k](/packages/ardagnsrn-ollama-php)[soukicz/llm

LLM client with support for cache, tools and async requests

445.6k](/packages/soukicz-llm)[anilcancakir/laravel-ai-sdk-skills

A skill system for Laravel AI SDK agents. Define reusable AI capabilities with SKILL.md files.

151.1k](/packages/anilcancakir-laravel-ai-sdk-skills)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
