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

A production-ready Laravel package to integrate with the Google Gemini API. Supports text, image, video, audio, long-context, structured output, files, caching, function-calling and understanding capabilities.

Frequently asked questions about Laravel Gemini
How do I install and set up this package in Laravel?
Run `composer require hosseinhezami/laravel-gemini`, publish the config with `php artisan vendor:publish --tag=gemini-config`, and add your `GEMINI_API_KEY` to your `.env` file. The package auto-configures for Laravel 10+ and requires no additional setup beyond these steps.
Does this package support real-time streaming responses from Gemini?
Yes, the package includes streaming capabilities with configurable chunk sizes and timeouts. Use `Gemini::stream()` to handle responses incrementally, ideal for chatbots or live AI interactions.
Can I use function-calling with custom tools in this package?
The package supports Gemini’s function-calling feature, allowing you to define custom tools. However, you’ll need to manually structure the function schemas in your prompts, as the package doesn’t auto-generate tool configurations.
What Laravel versions are officially supported?
This package is fully compatible with Laravel 10 and 11. It leverages Laravel’s service container and facades, so no additional adjustments are needed for these versions.
How does caching work, and can I customize it?
The package integrates with Laravel’s cache drivers (e.g., Redis, file, database) to cache responses. Configure the default TTL and cache tags in `config/gemini.php` to optimize performance and reduce API costs.
Are there built-in retries for failed API requests?
Yes, the package includes a retry policy with configurable max retries (default: 3) and delay (default: 1 second). Adjust these in `config/gemini.php` under `retry_policy` for your reliability needs.
Can I process large files (e.g., videos or audio) with this package?
The package supports file uploads for video, audio, and document processing, but large files may require chunked uploads or custom logic. Ensure your server has PHP extensions like `fileinfo`, `gd`, and `curl` enabled for optimal performance.
Does this package work with Laravel Queues for async processing?
Yes, you can dispatch Gemini tasks to Laravel Queues for async processing, especially useful for long-running tasks like video analysis. Use the `Gemini::generate()` method with queue jobs to offload heavy workloads.
How do I handle API rate limits or throttling?
The package includes rate-limiting logic, but test under load to ensure it meets your needs. For stricter control, implement middleware to enforce additional limits or use Laravel’s `throttle` middleware in combination.
Are there alternatives if I need offline AI capabilities?
This package relies solely on Google Gemini’s API and lacks built-in offline fallbacks. For hybrid solutions, consider integrating a local LLM (e.g., Ollama) alongside this package, using caching as a fallback mechanism.
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.
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
anil/file-picker
broqit/fields-ai