hosseinhezami/laravel-gemini
Laravel package for integrating Google Gemini into your app. Send prompts, manage chats and responses, and work with text generation via a clean, developer-friendly API. Ideal for quickly adding AI features to Laravel projects.
Add file method to BaseBuilder for specifying pre-uploaded file URIs with MIME types
This update introduces a new file method in BaseBuilder, allowing users to provide a direct file URI (e.g., from a previous independent upload via FileBuilder) along with the file type and MIME type. It sets corresponding params without triggering an upload.
In GeminiProvider's buildRequestBody, logic is added to check for these params and use the provided URI and MIME type instead of performing an upload, enabling seamless integration with existing uploaded files (e.g., in text generation flows).
array key is not found issue in multipart responsesImageResponse class to scan all available parts❌ No breaking changes - This update is fully backward compatible
$image = Gemini::generateImage('A beautiful sunset');
$image->save('sunset.png');
Full Changelog: https://github.com/hosseinhezami/laravel-gemini/compare/v1.0.2...v1.0.3
This PR introduces dynamic API key configuration via a new setApiKey() method and refactors file handling (CRUD operations) for better consistency. It also enhances the HttpClient class to support runtime API key and base URI settings, improving flexibility without breaking existing functionality.
Feat: Dynamic API Key Setting
Gemini::setApiKey('custom-key') method to allow runtime override of API key (falls back to .env/config if not set).Gemini, ProviderFactory, BaseProvider, and HttpClient to propagate the custom key.Refactor: File CRUD Improvements
GeminiProvider and BaseProvider.HttpClient for all file operations, removing raw HTTP calls.Refactor: HttpClient Enhancements
HttpClient to accept optional apiKey and baseUrl in constructor for dynamic configuration.withHeaders() and withBody() to support resumable uploads and other requests.These changes make the package more flexible for multi-tenant apps or dynamic environments, while cleaning up code for maintainability. No breaking changes; backward compatibility preserved.
Full Changelog: https://github.com/hosseinhezami/laravel-gemini/compare/v1.0.1...v1.0.2
feat(caching): integrate Gemini API caching support
This introduces full support for cached contents to optimize generation requests:
No breaking changes; backward-compatible with existing features.
A production-ready Laravel package to integrate with the Google Gemini API. Supports text, image, video, audio, long-context, structured output, function-calling and understanding capabilities.
How can I help you explore Laravel packages today?