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. [Utility &amp; Helpers](/categories/utility)
4. /
5. artryazanov/yt-cover-gen

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

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

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

v3.0.0(1mo ago)1523MITPHPPHP ^8.2CI passing

Since Jan 31Pushed 1mo 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 1w ago

READMEChangelog (10)Dependencies (31)Versions (21)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 (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`Features
--------

[](#features)

- **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 Gemini models (`gemini-3.1-flash-image`, `gemini-3-pro-image`, etc.).
- **Smart Text Generation**: If the input title is short (&lt;= 5 words), it is used directly to save API tokens and time. If it is longer, a text LLM condenses it into a short, punchy 2-5 word clickbait phrase. Then a vision model renders the final thumbnail.
- **Smart Logo Extraction**: Optionally pass an official game cover to accurately reproduce the game's logo in the thumbnail. The generator uses AI to extract a "clean" logo from the cover and caches it to prevent unwanted cover art elements from bleeding into the final thumbnail (supported by Gemini).
- **Self-Correcting Validation Loop**: Automatically evaluates the generated thumbnail using a vision-language model to check for AI artifacts, spelling errors, and readability. If the thumbnail fails validation, it regenerates up to 3 times with specific correction instructions.
- **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
- `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`):**

    ```
    # Gemini Configuration
    GEMINI_API_KEY=AIza...
    YT_COVER_GEN_GEMINI_MODEL=gemini-3.1-flash-image
    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';
        $gameCover = '/path/to/official_cover.png'; // Optional: for accurate logo generation

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

        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.

#### Google Gemini Example

[](#google-gemini-example)

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

```
use Artryazanov\YtCoverGen\CoverGeneratorFactory;
use Artryazanov\YtCoverGen\Enums\GeminiImageModelEnum;
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',
    GeminiImageModelEnum::GEMINI_3_1_FLASH_IMAGE->value, // Optional custom image model
    \Artryazanov\YtCoverGen\Enums\GeminiTextModelEnum::GEMINI_3_1_PRO_PREVIEW->value, // Optional custom text model
    '16:9',         // Optional custom aspect ratio
    '1K'            // Optional custom resolution
);

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

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

[](#supported-models)

### Gemini Models

[](#gemini-models)

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

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

The package also includes an Enum `Artryazanov\YtCoverGen\Enums\GeminiTextModelEnum` for text generation:

- `gemini-3.1-pro-preview`

Testing
-------

[](#testing)

Run the tests with:

```
composer test
```

License
-------

[](#license)

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

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance92

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% 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 ~9 days

Recently: every ~1 days

Total

18

Last Release

41d ago

Major Versions

v1.0.4 → v2.0.02026-06-25

v2.0.11 → v3.0.02026-07-01

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4519328?v=4)[Artem Ryazanov](/maintainers/artryazanov)[@artryazanov](https://github.com/artryazanov)

---

Top Contributors

[![artryazanov](https://avatars.githubusercontent.com/u/4519328?v=4)](https://github.com/artryazanov "artryazanov (40 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")[![google-labs-jules[bot]](https://avatars.githubusercontent.com/in/842251?v=4)](https://github.com/google-labs-jules[bot] "google-labs-jules[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

[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k19](/packages/tempest-framework)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

86337.5k](/packages/flow-php-flow)[cakephp/cakephp

The CakePHP framework

8.9k20.0M1.8k](/packages/cakephp-cakephp)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6943.5M448](/packages/drupal-core-recommended)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[mcp/sdk

Model Context Protocol SDK for Client and Server applications in PHP

1.6k2.2M136](/packages/mcp-sdk)

PHPackages © 2026

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