google-gemini-php/symfony
Symfony integration for Google Gemini PHP, making it easy to configure the Gemini API and use text, chat, and vision features via Symfony services. Lightweight, framework-friendly setup for AI-powered apps.
google-gemini-php/client SDK as a Symfony service, exposes config for API key/model defaults/base_url, and gets out of the way. The build-vs-buy question is really "spend half a day writing DI glue, or composer require it." For a spike or MVP, buying wins on time-to-first-call. The 2.1.0 release reinforces the buy case: the base_url config gap that previously forced a hand-rolled service definition is now fixed upstream.base_url extends that governance surface to routing: pointing traffic at a corporate AI gateway, a regional endpoint for data residency, or a recording proxy is now a YAML change rather than a code change.google-gemini-php/client or the Laravel integration. Treat this bundle as the Symfony-only branch of that family and make the stack call explicitly before anyone adds it to a Laravel backlog.ClientFake, which means the eval set and regression tests in the proposed spike don't require live API calls or recorded fixtures. That lowers the cost of the "measure quality/latency/cost against incumbent" step and makes the kill criteria cheap to actually run.Gemini\Contracts\ClientContract, an SDK-level interface, so application code can depend on a contract rather than the bundle's concrete service.Adopt it when:
base_url override for gateway/proxy/regional routing) instead of hand-rolling a service definition around the SDK.ClientContract, not the bundle's service, so the seam exists.Look elsewhere when:
ClientFake helps with unit tests, not with embeddings storage and retrieval — budget separately.One-liner for executives: A small, MIT-licensed Symfony integration for Google's Gemini API that lets us put an LLM behind an existing service in days, not a quarter — with no license cost, token-based pricing we can meter, and an endpoint we can point at our own gateway.
The case: We have concrete, near-term features (summarization, classification, in-app assistant) that need a model call and nothing more. This package removes the boilerplate and keeps API keys, model settings, and now endpoint routing in the config system we already operate. Release 2.1.0 closes the two gaps that made it feel improvised: proxy/regional endpoints are config rather than custom code, and the client is injectable via a published interface, so our domain code isn't welded to a third-party package's internals. It's a spike-grade investment: hours of integration, low exit cost, and now a supported framework path through Symfony 8.
The honest risk, stated up front: It is still a young package — a thin wrapper over someone else's SDK, with no downstream dependents to act as a canary. 2.1.0 shows the maintainer is responsive, which reduces the abandonment risk but doesn't establish a track record. Mitigation is cheap and unchanged in shape, now easier in practice: define one internal interface for "generate/classify" in our own code, inject the Gemini client behind it via ClientContract, and a future swap to Vertex AI or another provider becomes a config change rather than a refactor. We should not let this package's types — or the SDK's request/response objects — leak into domain code.
What we're asking for: A two-week time-boxed spike — integrate behind the interface, use ClientFake for the fast test loop, run an eval set of ~200 real examples, and report quality, p95 latency, and cost per 1,000 calls against the incumbent. Kill criteria: if quality or cost doesn't beat current handling, we keep the interface and drop the provider without sunk cost. Prerequisite to confirm in week one: the PHP 8.2+ runtime requirement for the current client feature set, since that upgrade may be on a different team's schedule.
For engineering: composer require, one config file (gemini.yaml — API key, model defaults, optional base_url), autow ire against Gemini\Contracts\ClientContract. No new infrastructure, no vendor lock at the code level if the interface boundary holds, and ClientFake for tests.
How can I help you explore Laravel packages today?