Skip to content

universe-coder/php-self-heallm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php-self-heallm

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.

About

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).

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages