TheDocumentation 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.
aisdk/google package is the official Google Gemini provider for the PHP AI SDK. It bridges the PHP AI SDK’s unified interface with Google’s Generative Language API, giving you access to the full Gemini model family — including text generation, streaming, image generation, tool calling, structured output, and multimodal input — through a clean, type-safe PHP API.
Quickstart
Get a working Gemini text generation call running in under five minutes.
Installation
Install via Composer and configure your API key.
Text Generation
Generate text with any Gemini model, including system instructions.
Streaming
Stream tokens in real time using Server-Sent Events.
Image Generation
Generate images with Gemini image models, control aspect ratio and size.
Tool Calling
Use function calling to let Gemini invoke your PHP functions.
Structured Output
Get back validated JSON objects and arrays from Gemini.
API Reference
Full reference for every public class, method, and option.
Why aisdk/google?
Theaisdk/google package plugs into the PHP AI SDK’s provider system so you get a portable, framework-agnostic interface to Gemini without writing HTTP boilerplate. Switch between Gemini model generations — 1.5, 2.0, 2.5, and 3.x — without changing application code.
Text & Streaming
Full text generation with SSE streaming and token usage reporting.
Images
Native image generation with aspect ratio and resolution control.
Multimodal
Send images, audio, and files alongside text prompts.
Tool Calling
Function calling with streaming deltas and multi-turn tool loops.
Structured Output
JSON output with schema enforcement via response_schema.
Reasoning
Control Gemini’s thinking depth with low, medium, or high effort.
Quick Example
quickstart.php
Generate your first response
Call
Google::model() with any Gemini model ID and chain it into Generate::text()->run().Explore the guides
Learn streaming, image generation, tool calling, and more in the Guides section.