PHPackages                             artryazanov/yt-cover-gen - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. artryazanov/yt-cover-gen

ActiveLibrary

artryazanov/yt-cover-gen
========================

A PHP package to generate YouTube thumbnails from screenshots using AI.

v1.0.3(1w ago)1122↓100%MITPHPPHP ^8.2CI passing

Since Jan 31Pushed 1w agoCompare

[ Source](https://github.com/artryazanov/yt-cover-gen)[ Packagist](https://packagist.org/packages/artryazanov/yt-cover-gen)[ RSS](/packages/artryazanov-yt-cover-gen/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (8)Versions (5)Used By (0)

YouTube AI Cover Generator
==========================

[](#youtube-ai-cover-generator)

[![Tests](https://github.com/artryazanov/yt-cover-gen/actions/workflows/tests.yml/badge.svg)](https://github.com/artryazanov/yt-cover-gen/actions/workflows/tests.yml)[![codecov](https://camo.githubusercontent.com/7b6d0d1fa2e3bc7cba7968d516dc6678a3c63f72e64d26ad23affbfc56ddfec9/68747470733a2f2f636f6465636f762e696f2f67682f6172747279617a616e6f762f79742d636f7665722d67656e2f67726170682f62616467652e7376673f746f6b656e3d434f4445434f565f544f4b454e)](https://codecov.io/gh/artryazanov/yt-cover-gen)[![Latest Stable Version](https://camo.githubusercontent.com/e7d8e0db4f758d0af77200ae691cd21c7593e498eb4e4c162ed81cb2ecd277ea/68747470733a2f2f706f7365722e707567782e6f72672f6172747279617a616e6f762f79742d636f7665722d67656e2f76)](https://packagist.org/packages/artryazanov/yt-cover-gen)[![Total Downloads](https://camo.githubusercontent.com/88426420145e4562677547a27c96bc5a2373ef5e3a9cfb0836ddece8e2a67d2d/68747470733a2f2f706f7365722e707567782e6f72672f6172747279617a616e6f762f79742d636f7665722d67656e2f646f776e6c6f616473)](https://packagist.org/packages/artryazanov/yt-cover-gen)[![License](https://camo.githubusercontent.com/7d0f7b71bd0a8fae768764b2f4dd56ee5d08f2d8343098cd935817117f2a44d1/68747470733a2f2f706f7365722e707567782e6f72672f6172747279617a616e6f762f79742d636f7665722d67656e2f6c6963656e7365)](https://packagist.org/packages/artryazanov/yt-cover-gen)

Introduction
------------

[](#introduction)

**YouTube AI Cover Generator** (`artryazanov/yt-cover-gen`) is a framework-agnostic PHP package designed to automatically generate viral, high-CTR (Click-Through Rate) YouTube thumbnails from gameplay screenshots using generic AI models.

It leverages powerful AI vision and image editing capabilities (OpenAI Image Models and Google Gemini) to analyze a screenshot, understand the context, and generate a stylized, professional-looking thumbnail with compelling text overlays and branding, strictly adhering to the game's art style.

Examples
--------

[](#examples)

SourceResultModel[![](assets/example1-source.jpg)](assets/example1-source.jpg)[![](assets/example1-gemini-result.jpg)](assets/example1-gemini-result.jpg)**Gemini**
`gemini-3-pro-image-preview`[![](assets/example2-source.jpg)](assets/example2-source.jpg)[![](assets/example2-openai-result.jpg)](assets/example2-openai-result.jpg)**OpenAI**
`gpt-image-1.5`[![](assets/example3-source.jpg)](assets/example3-source.jpg)[![](assets/example3-openai-result.jpeg)](assets/example3-openai-result.jpeg)**OpenAI**
`gpt-image-1.5`Features
--------

[](#features)

- **Multi-Driver Support**: Switch seamlessly between OpenAI and Google Gemini.
- **Automatic Bidirectional Fallback**:
    - If `driver` is `openai`: Falls back to Gemini if OpenAI fails.
    - If `driver` is `gemini`: Falls back to OpenAI if Gemini fails (e.g., content refusal).
- **Framework Agnostic**: Can be used in any PHP 8.2+ project.
- **Laravel Integration**: Includes a Service Provider, Facade-friendly architecture, and configuration publishing.
- **Configurable Models**: Supports various OpenAI models (`gpt-image-1.5`, `gpt-image-1`, `gpt-image-1-mini`) and Gemini models (`gemini-3.1-flash-image-preview`, `gemini-2.5-flash-image`, etc.).
- **Smart Image Processing**: Handles image resizing, format conversion, and Base64 encoding/decoding automatically using GD (no external binaries required).
- **Prompt Engineering**: Built-in, battle-tested prompt templates optimized for high CTR.

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- `ext-gd` extension
- `ext-json` extension
- `openai-php/client` (for OpenAI driver)
- `gemini-api-php/client` (for Gemini driver)
- PSR-17 and PSR-18 compatible HTTP client/factory (for Gemini driver)

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require artryazanov/yt-cover-gen
```

Configuration
-------------

[](#configuration)

### Laravel

[](#laravel)

1. **Publish the configuration file:**

    ```
    php artisan vendor:publish --tag=yt-cover-gen-config
    ```
2. **Configure environment variables (`.env`):**

    The package supports automatic fallback. Set your preferred primary driver in `YT_COVER_GEN_DRIVER`. If the primary driver fails and credentials for the secondary driver are present, it will automatically attempt generation with the secondary driver.

    ```
    # Driver Selection: 'openai' or 'gemini'
    # If 'openai': tries OpenAI first -> falls back to Gemini
    # If 'gemini': tries Gemini first -> falls back to OpenAI
    YT_COVER_GEN_DRIVER=openai

    # OpenAI Configuration
    OPENAI_API_KEY=sk-...
    YT_COVER_GEN_OPENAI_MODEL=gpt-image-1.5
    YT_COVER_GEN_OPENAI_SIZE=1536x1024
    YT_COVER_GEN_OPENAI_QUALITY=auto

    # Gemini Configuration
    GEMINI_API_KEY=AIza...
    YT_COVER_GEN_GEMINI_MODEL=gemini-3.1-flash-image-preview
    YT_COVER_GEN_GEMINI_ASPECT_RATIO=16:9
    YT_COVER_GEN_GEMINI_RESOLUTION=1K
    ```

### Generic PHP

[](#generic-php)

For non-Laravel projects, you can use the `CoverGeneratorFactory` to instantiate generators directly.

Usage
-----

[](#usage)

### Basic Usage (Laravel)

[](#basic-usage-laravel)

Inject the `CoverGeneratorInterface` into your class (Controller, Command, Job, etc.):

```
use Artryazanov\YtCoverGen\Contracts\CoverGeneratorInterface;

class CreateThumbnail
{
    public function __construct(
        private CoverGeneratorInterface $generator
    ) {}

    public function handle()
    {
        $pathToScreenshot = '/path/to/screenshot.jpg';
        $gameName = 'Elden Ring';
        $videoTitle = 'NO HIT RUN PART 1';

        // Returns absolute path to the generated image
        $coverPath = $this->generator->generate(
            $pathToScreenshot,
            $gameName,
            $videoTitle
        );

        echo "Thumbnail generated at: $coverPath";
    }
}
```

### Advanced Usage (Generic PHP / Custom Configuration)

[](#advanced-usage-generic-php--custom-configuration)

You can use the Factory to create generators with specific configurations on the fly.

#### OpenAI Example

[](#openai-example)

```
use Artryazanov\YtCoverGen\CoverGeneratorFactory;
use Artryazanov\YtCoverGen\Enums\OpenAiModelEnum;
use Artryazanov\YtCoverGen\Enums\OpenAiQualityEnum;

$apiKey = 'your-openai-api-key';

$generator = CoverGeneratorFactory::createOpenAi(
    $apiKey,
    '/path/to/output/dir', // Optional output directory
    OpenAiModelEnum::GPT_IMAGE_1_5->value, // Optional custom model
    '1024x1024', // Optional custom size
    OpenAiQualityEnum::HIGH->value // Optional custom quality
);

$path = $generator->generate('screenshot.jpg', 'My Game', 'Awesome Video');
```

#### Google Gemini Example

[](#google-gemini-example)

Gemini requires PSR-18 HTTP Client dependencies (e.g., Guzzle).

```
use Artryazanov\YtCoverGen\CoverGeneratorFactory;
use Artryazanov\YtCoverGen\Enums\GeminiModelEnum;
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\HttpFactory;

$client = new Client();
$httpFactory = new HttpFactory();

$generator = CoverGeneratorFactory::createGemini(
    'your-gemini-api-key',
    $client,        // PSR-18 Client
    $httpFactory,   // PSR-17 Request Factory
    $httpFactory,   // PSR-17 Stream Factory
    '/path/to/output/dir',
    GeminiModelEnum::GEMINI_3_1_FLASH_IMAGE_PREVIEW->value, // Optional custom model
    '16:9',         // Optional custom aspect ratio
    '2K'            // Optional custom resolution
);

$path = $generator->generate('screenshot.jpg', 'My Game', 'Awesome Video');
```

Supported Models
----------------

[](#supported-models)

### OpenAI Models

[](#openai-models)

The package includes an Enum `Artryazanov\YtCoverGen\Enums\OpenAiModelEnum` for easy reference:

- `gpt-image-1.5` (Default)
- `gpt-image-1`
- `gpt-image-1-mini`

### Gemini Models

[](#gemini-models)

The package includes an Enum `Artryazanov\YtCoverGen\Enums\GeminiModelEnum`:

- `gemini-3.1-flash-image-preview` (Default)
- `gemini-3-pro-image-preview`
- `gemini-2.5-flash-image`

Testing
-------

[](#testing)

Run the tests with:

```
composer test
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance98

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~13 days

Total

4

Last Release

8d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6357ca96399697b30326b317cf64cb85eb01005fb296cf50176d4008cf448135?d=identicon)[artryazanov](/maintainers/artryazanov)

---

Top Contributors

[![artryazanov](https://avatars.githubusercontent.com/u/4519328?v=4)](https://github.com/artryazanov "artryazanov (14 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")

---

Tags

ai-assistedai-image-generationautomationcomposer-packagegameplaygeminigenerative-aihigh-ctrlaravelopenaiphpscreenshotsthumbnail-generatoryoutube

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/artryazanov-yt-cover-gen/health.svg)

```
[![Health](https://phpackages.com/badges/artryazanov-yt-cover-gen/health.svg)](https://phpackages.com/packages/artryazanov-yt-cover-gen)
```

###  Alternatives

[neos/flow

Flow Application Framework

862.0M398](/packages/neos-flow)[wtfzdotnet/php-tmdb-api

PHP wrapper for TMDB (TheMovieDatabase) API v3. Supports two types of approaches, one modelled with repositories, models and factories. And the other by simple array access to RAW data from The Movie Database.

4242.9k](/packages/wtfzdotnet-php-tmdb-api)[azuracast/nowplaying

A lightweight PHP adapter for viewing the current now playing data in Icecast and SHOUTcast 1/2. A part of the AzuraCast software suite.

3043.8k1](/packages/azuracast-nowplaying)[chillerlan/php-httpinterface

A PSR-7/17/18 http message/client implementation

1416.7k5](/packages/chillerlan-php-httpinterface)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[segrax/open-policy-agent

Open Policy Agent client and PSR-7, PSR-15 Authorization Middleware

212.0k](/packages/segrax-open-policy-agent)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
