PHPackages                             minhyung/error-solutions-gemini - 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. minhyung/error-solutions-gemini

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

minhyung/error-solutions-gemini
===============================

Solution Provider using Gemini

0.1.0(7mo ago)00MITPHPCI passing

Since Dec 30Pushed 7mo agoCompare

[ Source](https://github.com/overworks/error-solutions-gemini)[ Packagist](https://packagist.org/packages/minhyung/error-solutions-gemini)[ RSS](/packages/minhyung-error-solutions-gemini/feed)WikiDiscussions 0.x Synced 2mo ago

READMEChangelogDependencies (6)Versions (2)Used By (0)

error-solutions-gemini
======================

[](#error-solutions-gemini)

[![Tests](https://github.com/overworks/error-solutions-gemini/actions/workflows/tests.yml/badge.svg)](https://github.com/overworks/error-solutions-gemini/actions/workflows/tests.yml)

A [spatie/error-solutions](https://github.com/spatie/error-solutions) compatible Solution Provider powered by Google Gemini AI.

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

[](#requirements)

- PHP 8.2+
- Composer

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

[](#installation)

```
composer require minhyung/error-solutions-gemini
```

Basic Usage
-----------

[](#basic-usage)

```
use Minhyung\ErrorSolutionsGemini\Solutions\Gemini\GeminiSolutionProvider;
use Spatie\ErrorSolutions\SolutionProviderRepository;

$repository = new SolutionProviderRepository([
    new GeminiSolutionProvider(
        apiKey: 'your-gemini-api-key',
        applicationType: 'PHP 8.3',
        applicationPath: __DIR__,
    ),
]);

try {
    // Code that throws
    throw new \RuntimeException('Undefined variable $foo');
} catch (\Throwable $e) {
    $solutions = $repository->getSolutionsForThrowable($e);

    foreach ($solutions as $solution) {
        echo $solution->getSolutionTitle() . "\n";
        echo $solution->getSolutionDescription() . "\n";

        foreach ($solution->getDocumentationLinks() as $title => $url) {
            echo "- {$title}: {$url}\n";
        }
    }
}
```

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

[](#configuration)

### GeminiSolutionProvider constructor options

[](#geminisolutionprovider-constructor-options)

- `apiKey` (required): Gemini API key
- `cache` (optional): PSR-16 cache implementation
- `cacheTtlInSeconds` (optional): Cache TTL, default 3600 seconds
- `applicationType` (optional): Application type (e.g., `Laravel 11`, `Symfony 7`)
- `applicationPath` (optional): Application root path for code snippet extraction
- `model` (optional): Gemini model, defaults to `Gemini\Enums\ModelType::GEMINI_FLASH`

### Cache usage example

[](#cache-usage-example)

```
use Psr\SimpleCache\CacheInterface;

$provider = new GeminiSolutionProvider(
    apiKey: 'your-gemini-api-key',
);

// Enable cache (optional)
$provider->useCache($cache, cacheTtlInSeconds: 7200);
```

How It Works
------------

[](#how-it-works)

1. When an exception occurs, a prompt is built with file path, line number, code snippet, and the exception message.
2. The prompt is sent to the Gemini API to request an AI-generated solution.
3. The response is parsed to extract the fix (`FIX/ENDFIX`) and related documentation links (`LINKS/ENDLINKS`).
4. When cache is enabled, repeat calls for the same exception are avoided.

###  Health Score

24

—

LowBetter than 30% of packages

Maintenance62

Regular maintenance activity

Popularity0

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 Bus Factor1

Top contributor holds 75% 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 ~0 days

Total

2

Last Release

232d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/381cd0165a6aa9f238950dc1ae39f15a2b01a3dc33c111cd0fc1b12ab4259100?d=identicon)[lostland](/maintainers/lostland)

---

Top Contributors

[![sejongtf-minhyung](https://avatars.githubusercontent.com/u/69459877?v=4)](https://github.com/sejongtf-minhyung "sejongtf-minhyung (6 commits)")[![overworks](https://avatars.githubusercontent.com/u/2780002?v=4)](https://github.com/overworks "overworks (2 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/minhyung-error-solutions-gemini/health.svg)

```
[![Health](https://phpackages.com/badges/minhyung-error-solutions-gemini/health.svg)](https://phpackages.com/packages/minhyung-error-solutions-gemini)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.9k3.8M1.2k](/packages/statamic-cms)[spatie/flare-client-php

Send PHP errors to Flare

178166.2M24](/packages/spatie-flare-client-php)[spatie/ignition

A beautiful error page for PHP applications.

517165.2M86](/packages/spatie-ignition)[spatie/laravel-ray

Easily debug Laravel apps

31842.2M3.8k](/packages/spatie-laravel-ray)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

137236.2k8](/packages/statamic-rad-pack-runway)[eliashaeussler/typo3-solver

Solver - Extends TYPO3's exception handling with AI generated solutions. Problems can also be solved from command line. Several OpenAI parameters are configurable and prompts and solution providers can be customized as desired.

302.1k](/packages/eliashaeussler-typo3-solver)

PHPackages © 2026

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