Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Gemini Laravel Package

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.

View on GitHub
Deep Wiki
Context7
v1.0.4

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).

v1.0.3

Multipart Response Support for Gemini API

  • Fixed array key is not found issue in multipart responses
  • Enhanced handling of multiple parts in Image Generation responses
  • Added proper error handling for missing image data scenarios

🔧 Technical Enhancements

  • Optimized ImageResponse class to scan all available parts
  • Added dedicated exception for image content related errors
  • Maintained full backward compatibility with previous versions

📝 Breaking Changes

No breaking changes - This update is fully backward compatible

🛠 Usage

Image Generation (Same as before)

$image = Gemini::generateImage('A beautiful sunset');
$image->save('sunset.png');

What's Changed

Full Changelog: https://github.com/hosseinhezami/laravel-gemini/compare/v1.0.2...v1.0.3

v1.0.2

What's Changed

Overview

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.

Changes

  • Feat: Dynamic API Key Setting

    • Added Gemini::setApiKey('custom-key') method to allow runtime override of API key (falls back to .env/config if not set).
    • Updated Gemini, ProviderFactory, BaseProvider, and HttpClient to propagate the custom key.
    • Ensures priority for manual set over .env.
  • Refactor: File CRUD Improvements

    • Optimized methods for upload, list, get, and delete files in GeminiProvider and BaseProvider.
    • Switched to consistent use of injected HttpClient for all file operations, removing raw HTTP calls.
    • Fixed inconsistencies in HTTP usage for file-related endpoints.
  • Refactor: HttpClient Enhancements

    • Modified HttpClient to accept optional apiKey and baseUrl in constructor for dynamic configuration.
    • Added chainable methods like withHeaders() and withBody() to support resumable uploads and other requests.

Rationale

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.

Contributors

Full Changelog: https://github.com/hosseinhezami/laravel-gemini/compare/v1.0.1...v1.0.2

v1.0.1

feat(caching): integrate Gemini API caching support

This introduces full support for cached contents to optimize generation requests:

  • New CacheBuilder class with methods for managing caches (create, list, get, update expiration, delete).
  • Chainable caching in BaseBuilder: cache() from params, getCache() for details, and cachedContent() for usage in builders.
  • GeminiProvider enhancements: new methods for caching operations; HttpClient updated for PATCH/DELETE.
  • CacheResponse class with accessors;
  • Config additions for default TTL/page size; Facade and Provider registrations.
  • Comprehensive README updates with independent and integrated usage examples.

No breaking changes; backward-compatible with existing features.

v1.0.0

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.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope