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(1mo ago)1122↓100%[1 PRs](https://github.com/artryazanov/yt-cover-gen/pulls)MITPHPPHP ^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 1mo ago

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

42

—

FairBetter than 90% of packages

Maintenance88

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

59d 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

[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[aporat/store-receipt-validator

PHP receipt validator for Apple App Store and Amazon Appstore

6503.9M9](/packages/aporat-store-receipt-validator)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[opensearch-project/opensearch-php

PHP Client for OpenSearch

15024.3M65](/packages/opensearch-project-opensearch-php)[tempest/framework

The PHP framework that gets out of your way.

2.1k23.1k9](/packages/tempest-framework)[neos/flow

Flow Application Framework

862.0M451](/packages/neos-flow)

PHPackages © 2026

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