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(4mo ago)00MITPHPCI passing

Since Dec 30Pushed 4mo 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 1mo 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

27

—

LowBetter than 49% of packages

Maintenance74

Regular maintenance activity

Popularity0

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity24

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

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

[spatie/ignition

A beautiful error page for PHP applications.

511147.6M69](/packages/spatie-ignition)[spatie/laravel-error-solutions

Display solutions on the Laravel error page

9773.5k](/packages/spatie-laravel-error-solutions)[laravel-enso/history-tracker

Model history tracking dependency for Laravel Enso

5246.8k5](/packages/laravel-enso-history-tracker)[eliashaeussler/typo3-solver

Extension for TYPO3 CMS to extend TYPO3's exception handling with AI generated solutions

292.1k](/packages/eliashaeussler-typo3-solver)[guywarner/laravel-google-chat-alerts

Send a message to GoogleChat

5333.0k](/packages/guywarner-laravel-google-chat-alerts)

PHPackages © 2026

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