vedanshi-shethia/gemini-banner

Laravel package to generate website banners using Gemini AI

Maintainers

Package info

github.com/vedanshi-shethia/gemini-banner

pkg:composer/vedanshi-shethia/gemini-banner

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2025-12-23 07:33 UTC

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.