PHPackages                             papi-ai/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. [API Development](/categories/api)
4. /
5. papi-ai/google

ActiveLibrary[API Development](/categories/api)

papi-ai/google
==============

Google Gemini provider for PapiAI

v0.9.1(2mo ago)0254MITPHPPHP ^8.2CI passing

Since Mar 7Pushed 1mo agoCompare

[ Source](https://github.com/papi-ai/google)[ Packagist](https://packagist.org/packages/papi-ai/google)[ RSS](/packages/papi-ai-google/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (6)Used By (0)

PapiAI Google Provider
======================

[](#papiai-google-provider)

[![CI](https://github.com/papi-ai/google/workflows/CI/badge.svg)](https://github.com/papi-ai/google/actions?query=workflow%3ACI) [![Latest Version](https://camo.githubusercontent.com/d71c04be69547f74b622c45c801515e37b9129f19ad900011498bd940f99d44b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706170692d61692f676f6f676c652e737667)](https://packagist.org/packages/papi-ai/google) [![Total Downloads](https://camo.githubusercontent.com/4ee5c245cfc2777378e974e210c33a54303bbf0832080f0f7d9fb6e6bad57d62/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706170692d61692f676f6f676c652e737667)](https://packagist.org/packages/papi-ai/google) [![PHP Version](https://camo.githubusercontent.com/8915606b4de1f8e44d18f3512b61fe10706e7583a2a37e75cf3ac17a6f0db803/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f706170692d61692f676f6f676c652e737667)](https://packagist.org/packages/papi-ai/google) [![License](https://camo.githubusercontent.com/6df76bb91e775daed17fe1318793d7d43472c568235adcfa63c118c5f2c94e32/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f706170692d61692f676f6f676c652e737667)](https://packagist.org/packages/papi-ai/google)

Google Gemini provider for [PapiAI](https://github.com/papi-ai/papi-core) - A simple but powerful PHP library for building AI agents.

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

[](#installation)

```
composer require papi-ai/google
```

Usage
-----

[](#usage)

```
use PapiAI\Core\Agent;
use PapiAI\Google\GoogleProvider;

$provider = new GoogleProvider(
    apiKey: $_ENV['GOOGLE_API_KEY'],
    defaultModel: GoogleProvider::MODEL_3_0_PRO,
);

$agent = new Agent(
    provider: $provider,
    model: 'gemini-3.0-pro',
    instructions: 'You are a helpful assistant.',
);

$response = $agent->run('Hello!');
echo $response->text;
```

Available Models
----------------

[](#available-models)

### Gemini (Text/Chat)

[](#gemini-textchat)

```
GoogleProvider::MODEL_3_1_PRO   // 'gemini-3.1-pro' (newest)
GoogleProvider::MODEL_3_0_PRO   // 'gemini-3.0-pro' (default)
GoogleProvider::MODEL_2_0_FLASH // 'gemini-2.0-flash-exp' (fast)
GoogleProvider::MODEL_1_5_PRO   // 'gemini-1.5-pro'
GoogleProvider::MODEL_1_5_FLASH // 'gemini-1.5-flash' (cost-effective)
```

### Imagen (Image Generation)

[](#imagen-image-generation)

```
GoogleProvider::IMAGEN_3      // 'imagen-3.0-generate-001' (best quality)
GoogleProvider::IMAGEN_3_FAST // 'imagen-3.0-fast-generate-001' (faster)
```

Features
--------

[](#features)

- Tool/function calling
- Vision/multimodal support
- Structured output (JSON mode)
- Streaming support
- Image generation (Imagen 3)

Image Generation
----------------

[](#image-generation)

Generate images using Google's Imagen 3 model:

```
use PapiAI\Google\GoogleProvider;

$provider = new GoogleProvider($_ENV['GOOGLE_API_KEY']);

// Generate image and get base64 data
$result = $provider->generateImage(
    prompt: 'A professional product photo of headphones on a white background',
    options: [
        'model' => GoogleProvider::IMAGEN_3,
        'aspectRatio' => '1:1',      // 1:1, 16:9, 9:16, 4:3, 3:4
        'numberOfImages' => 1,
        'negativePrompt' => 'blurry, low quality',
    ]
);

// Access generated image
$imageData = base64_decode($result['images'][0]['data']);
file_put_contents('output.png', $imageData);

// Or save directly to file
$provider->generateImageToFile(
    prompt: 'A modern minimalist workspace',
    outputPath: '/path/to/image.png'
);
```

License
-------

[](#license)

MIT

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance88

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~1 days

Total

5

Last Release

60d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/126c34b4dff8d42336ea07ac5297bcc3ec0a0e306fd964a7497f02240da4b142?d=identicon)[md](/maintainers/md)

---

Top Contributors

[![MarcelloDuarte](https://avatars.githubusercontent.com/u/144535?v=4)](https://github.com/MarcelloDuarte "MarcelloDuarte (19 commits)")

###  Code Quality

TestsPest

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/papi-ai-google/health.svg)

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

###  Alternatives

[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/common-protos

Google API Common Protos for PHP

173103.7M49](/packages/google-common-protos)[hubspot/api-client

Hubspot API client

23414.2M16](/packages/hubspot-api-client)

PHPackages © 2026

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