vedanshi-shethia / gemini-banner
Laravel package to generate website banners using Gemini AI
Requires
- php: ^8.1
- illuminate/support: ^9.0|^10.0|^11.0|^12.0
This package is auto-updated.
Last update: 2026-03-23 08:14:58 UTC
README
Gemini Banner Generator for Laravel
A Laravel package to generate high-quality website advertisement banners using Google Gemini Image API, designed specifically for book stores and publishers.
This package strictly preserves original book cover text, typography, and layout by enforcing copy-paste image usage instead of AI text recreation.
โจ Features
- ๐จ AI-generated website banners using Google Gemini
- ๐ Private input images, ๐ public generated banners
- โ Zero text distortion or hallucination
- ๐ Aspect-ratio locking via reference image
- โก Sync & Async (Queue) support
- ๐งฑ Clean service-based architecture
- ๐ช Facade for simple usage
- ๐งช Queue-safe & retry-safe
- โ๏ธ Fully configurable storage paths & disks
- ๐ฆ Laravel auto-discovery support
๐ฆ Installation
Via Composer
composer require vedanshi-shethia/gemini-banner
โ๏ธ Configuration
Publish the config file:
php artisan vendor:publish --tag=gemini-banner
This creates:
config/gemini-banner.php
๐ Storage Symlink (Required)
This package stores generated banners on the public disk. Make sure the public storage symlink exists:
php php artisan storage:link
This creates:
public/storage โ storage/app/public
๐ Environment variables
GEMINI_API_KEY=your_google_gemini_api_key # Storage GEMINI_INPUT_DISK=local GEMINI_OUTPUT_DISK=public
๐ง Storage Design (Important)
This package follows industry best practices:
| Type | Disk | Visibility |
|---|---|---|
| Input images | local |
๐ Private |
| Generated banners | public |
๐ Public |
storage/
โโโ app/
โ โโโ private/
โ โ โโโ gemini/input/
โ โโโ public/
โ โโโ gemini/output/
โ๏ธ Config Reference
return [ 'api_key' => env('GEMINI_API_KEY'), 'endpoint' => 'https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image:generateContent', 'disks' => [ 'input' => env('GEMINI_INPUT_DISK', 'local'), 'output' => env('GEMINI_OUTPUT_DISK', 'public'), ], 'paths' => [ 'front' => 'gemini/input/front', 'back' => 'gemini/input/back', 'reference' => 'gemini/input/reference', 'output' => 'gemini/output', ], 'cleanup' => [ 'enabled' => true, ], ];
๐ Usage
1๏ธโฃ Sync Generation (Facade)
use Vedanshi\GeminiBanner\Facades\GeminiBanner; use Vedanshi\GeminiBanner\Http\Requests\GenerateBannerRequest; function (GenerateBannerRequest $request) { $result = GeminiBanner::generate($request->payload()); }
Returns a public URL of the generated banner.
2๏ธโฃ Async Generation (Queue)
use Vedanshi\GeminiBanner\Jobs\GenerateGeminiBannerJob; use Vedanshi\GeminiBanner\Http\Requests\GenerateBannerRequest; function (GenerateBannerRequest $request) { GenerateGeminiBannerJob::dispatch($request->payload()); }
โ Ideal for:
- Heavy image processing
- High-traffic systems
- Background workflows
๐งพ Expected Payload Structure
[
'front_image' => string, // path on input disk
'back_image' => string, // path on input disk
'transparent_image' => string, // path on input disk
'product_name' => string,
]
โ ๏ธ Do NOT pass temp paths (
php/tmp). Files must be stored first using Laravel storage.
๐งน Automatic Cleanup
- Input images are deleted immediately after successful generation
- Cleanup is retry-safe
- Cleanup can be disabled via config
'cleanup' => [ 'enabled' => false, ],
๐งฑ Architecture Overview
Request / Job
โ
GenerateBannerRequest
โ
GeminiBannerService
โ
Gemini API
โ
Public Storage (output)
- No controllers are published
- No routes are forced
- You stay in control of your application flow
๐ Requirements
- PHP 8.1+
- Laravel 9.x / 10.x / 11.x / 12.x
- Google Gemini API access
๐ License
MIT License
๐ Credits
Developed by Vedanshi Shethia Powered by Google Gemini AI
๐ค Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss improvements.