akpagni5547/filament-gemini-search
Composer 安装命令:
composer require akpagni5547/filament-gemini-search
包简介
Filament plugin for Gemini API search with Google Search Grounding
README 文档
README
A Filament v4/v5 plugin that integrates Google Gemini API with Google Search Grounding to perform real-time web searches directly from your admin panel.
Gemini doesn't just generate text — it performs real Google searches, analyzes the results, and returns structured responses with verifiable sources.
Features
- Real-time web search via Gemini + Google Search Grounding
- Dedicated search page with Markdown result rendering
- Compact dashboard widget
- Clickable sources and links to found websites
- Search history stored in database
- Multi-language support (EN/FR)
- Full dark mode support
- Compatible with Filament v4 and v5
Getting a Gemini API Key
Step 1: Create a Google AI Studio Account
- Go to Google AI Studio
- Sign in with your Google account
Step 2: Generate an API Key
- Click "Get API Key" in the left menu
- Click "Create API Key"
- Select a Google Cloud project (or create one)
- Copy the generated key (format:
AIzaSy...)
Step 3: Free vs Paid Plan
| Free Plan | Paid Plan (Pay-as-you-go) | |
|---|---|---|
| Requests/minute | 15 | 2,000 |
| Requests/day | 1,500 | Unlimited |
| Grounding Search | Included | Included |
| Cost | $0 | ~$0.001-0.01 / request |
Tip: The free plan is more than enough for development and moderate production use. To enable billing, visit Google Cloud Console > Billing.
Step 4: Enable the API
If you encounter 403 errors, enable the API manually:
- Go to Google Cloud Console > APIs
- Search for "Generative Language API"
- Click "Enable"
Installation
composer require akpagni5547/filament-gemini-search
Add your key to .env:
GEMINI_API_KEY=AIzaSy...your-key-here GEMINI_MODEL=gemini-2.5-flash
Publish the configuration and run migrations:
php artisan vendor:publish --tag=gemini-search-config php artisan migrate
Register the plugin in your PanelProvider:
use SelfProject\FilamentGeminiSearch\FilamentGeminiSearchPlugin; public function panel(Panel $panel): Panel { return $panel // ... ->plugin(FilamentGeminiSearchPlugin::make()); }
Configuration
// config/gemini-search.php return [ 'api_key' => env('GEMINI_API_KEY'), 'model' => env('GEMINI_MODEL', 'gemini-2.5-flash'), 'grounding' => [ 'enabled' => true, // Enable Google Search Grounding ], 'history' => [ 'enabled' => true, // Save searches in DB 'max_records' => 500, ], 'navigation' => [ 'group' => null, // Filament navigation group 'icon' => 'heroicon-o-magnifying-glass', 'sort' => 100, ], ];
Disable page or widget
FilamentGeminiSearchPlugin::make() ->disablePage() // Keep only the widget ->disableWidget() // Keep only the page
Use Cases
1. Price Monitoring / Comparison
Search for product prices across different e-commerce sites. Gemini performs the Google search and returns prices with links to stores.
"iPhone 16 Pro price comparison 2026"
Result: Price list with links to Amazon, Best Buy, etc.
2. Competitive Intelligence
Monitor what your competitors are doing, their offers, and latest news.
"Latest AWS pricing changes cloud computing March 2026"
Result: Summary of current offers with official sources.
3. Supplier Research
Find suppliers for your business needs directly from your back-office.
"Best wholesale office supplies distributors with delivery"
Result: List of suppliers with contacts and websites.
4. Enhanced Customer Support
Your support agents can search for product information in real-time to assist customers.
"Samsung Galaxy A15 full technical specifications"
Result: Detailed specifications with reliable sources.
5. Regulatory / Legal Research
Find information about current regulations.
"GDPR compliance requirements for SaaS companies 2026"
Result: Steps and required documents with official links.
6. Tech Watch
Stay informed about the latest tech trends from your admin dashboard.
"Laravel 12 new features and improvements"
Result: Summary of new features with links to official docs.
How It Works (Under the Hood)
+--------------+ +--------------+ +--------------+
| Filament UI |---->| Gemini API |---->| Google Search|
| (your app) | | (LLM) | | (grounding) |
+--------------+ +------+-------+ +--------------+
|
+-------v-------+
| Response with |
| - AI text |
| - Web sources |
| - Queries |
+---------------+
The key is the tools: [{ google_search: {} }] parameter in the API call. This tells Gemini: "Before answering, perform a real Google search and base your response on the results."
Available Gemini Models
| Model | Speed | Quality | Grounding |
|---|---|---|---|
gemini-2.5-flash |
Fast | Very good | Yes |
gemini-2.5-pro |
Slower | Excellent | Yes |
gemini-2.0-flash |
Very fast | Good | Yes |
gemini-2.0-flash-lite |
Ultra fast | Decent | Yes |
Recommended:
gemini-2.5-flash— best speed/quality ratio.
Testing
Quick Test (without Laravel)
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent" \ -H "x-goog-api-key: YOUR_KEY" \ -H "Content-Type: application/json" \ -X POST \ -d '{ "contents": [{"parts": [{"text": "Latest Laravel features"}]}], "tools": [{"google_search": {}}] }'
Test in Laravel (Tinker)
php artisan tinker
$service = app(\SelfProject\FilamentGeminiSearch\Services\GeminiSearchService::class); $result = $service->search('Latest Laravel 12 features'); echo $result->text; // Formatted response dump($result->sources); // Sources with URLs dump($result->searchQueries); // Google queries performed
License
MIT
akpagni5547/filament-gemini-search 适用场景与选型建议
akpagni5547/filament-gemini-search 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 15 次下载、GitHub Stars 达 6, 最近一次更新时间为 2026 年 03 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「search」 「google」 「laravel」 「Gemini」 「filament」 「grounding」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 akpagni5547/filament-gemini-search 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 akpagni5547/filament-gemini-search 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 akpagni5547/filament-gemini-search 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel package to retrieve data from Google Search Console
Indexed Search Autocomplete - Extends the TYPO3 Core Extension Indexed_Search searchform with an autocomplete feature.
Abstraction Layer to index and search entities
Magento 2 Social Login extension is designed for quick login to your Magento 2 store without procesing complex register steps
Pimcore 10.x Website Indexer (powered by Zend Search Lucene)
Symfony bundle for Elasticsearch integration with round-robin load balancing
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-04