self-heallm/php-self-heallm

Framework-agnostic PHP library for automated error triage and LLM-powered self-healing.

Maintainers

Package info

github.com/universe-coder/php-self-heallm

pkg:composer/self-heallm/php-self-heallm

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-05-09 22:12 UTC

This package is auto-updated.

Last update: 2026-05-09 22:15:14 UTC


README

Packagist (self-heallm/php-self-heallm)

Latest Version License PHP Version Symfony HttpClient Total Downloads Monthly Downloads

GitHub (universe-coder/php-self-heallm)

GitHub Stars Open Issues Last Commit GitHub forks

Canonical repository URLs are in composer.json (homepage, support). The Composer package name on Packagist remains self-heallm/php-self-heallm.

Framework-agnostic PHP Composer library that scans recent log errors, asks an LLM for a fix (OpenAI, Anthropic, Hugging Face OpenAI-compatible endpoint, or Ollama), validates path safety, optionally applies patches, and sends reports (Telegram, Slack, webhook, Sentry, JSONL file).

Install

composer require self-heallm/php-self-heallm

CLI

From your project root (with config/self-heal.php or env vars):

vendor/bin/self-heal

Or pass an explicit config path:

vendor/bin/self-heal --config=/absolute/path/to/self-heal.php

Copy config/self-heal.php into your app and adjust paths under log, reporting, and deduplication defaults (package defaults use <package>/var/... when shipped alone).

Programmatic use

use SelfHealLM\Bootstrap\SelfHealApplication;

$pipeline = SelfHealApplication::fromConfigFile(__DIR__ . '/config/self-heal.php');
$result = $pipeline->run(); // ['status' => 'ok'|'skipped', 'reason' => ...?]

Or build config in memory:

$pipeline = SelfHealApplication::fromConfigArray([
    'enabled' => true,
    'dry_run' => true,
    'log' => ['path' => '/var/log/app.log', 'max_lines' => 200],
    // ... same keys as in config/self-heal.php (no outer `self-heal` key required)
]);

Environment variables

Same SELF_HEAL_* names as the Laravel-oriented package; see config/self-heal.php for the full list. Set SELF_HEAL_OPENAI_TOKEN, SELF_HEAL_LOG_PATH, etc., in your process environment or .env loader before including the config file.

Security

  • Only paths under configured allowed_paths are accepted; forbidden_paths always win.
  • Auto-apply runs only when enabled, auto_apply, and dry_run are set accordingly in config.

Related

The laravel-self-heallm package targets Laravel apps; this library is suitable for any PHP runtime with Composer.

License

MIT. See LICENSE.