Simplifying Google Gemini Integration in Laravel
AI is becoming a core part of modern applications, from content generation and chat experiences to intelligent assistants and automation.
For Laravel applications that only need Google Gemini, a lightweight and dedicated integration can provide a simpler developer experience.
"laravel-gemini" is a Laravel package that provides a clean way to interact with the Google Gemini API.
Features
- Simple text generation
- Chat-style conversations
- Raw Gemini API access
- Normalized responses
- Facade and Dependency Injection support
- Laravel configuration and ".env" support
- Custom generation options per request
- Exception handling
Installation
composer require yasser-elgammal/laravel-gemini
Basic Usage
use YasserElgammal\LaravelGemini\Facades\Gemini;
$response = Gemini::generate('Explain Laravel service providers');
Chat Example
$response = Gemini::chat([
[
'role' => 'user',
'content' => 'Hello Gemini',
],
]);
Visit the Package on GitHub
Check out the source code, documentation, and contribute to the project:
Laravel Compatibility
The package supports:
- Laravel 10
- Laravel 11
- Laravel 12
- Laravel 13
with PHP 8.1+.
Documentation
Currently, the documentation is available through the README, covering the core usage and examples. More production-level examples and best practices will be added in future updates.
Feedback & Contributions
Feedback, issues, and contributions are always welcome. The goal is to make integrating Google Gemini into Laravel applications as simple and enjoyable as possible.