PHP code example of raffaelecarelle / php-error-insight
1. Go to this page and download the library: Download raffaelecarelle/php-error-insight library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
raffaelecarelle / php-error-insight example snippets
use PhpErrorInsight\Config;
use PhpErrorInsight\ErrorExplainer;
/ none | local | api
'model' => 'llama3:instruct',
'language'=> 'en',
'verbose' => true,
]);
ErrorExplainer::register($config); // sets up error and exception handlers
// Generate an error to see the output
strpos();
// tests/bootstrap.php
use PhpErrorInsight\Config;
use PhpErrorInsight\ErrorExplainer;
se 'text' for console output
'verbose' => false,
'editorUrl' => 'phpstorm://open?file=%file&line=%line',
'projectRoot' => dirname(__DIR__),
]);
ErrorExplainer::register($config);
function login(string $username, #[SensitiveParameter] string $password) {
// If an error occurs here, $password will be masked as ***REDACTED***
// in all error outputs (HTML, CLI, JSON) and AI prompts
}
use PhpErrorInsight\Internal\Util\SensitiveParameterSanitizer;
$sanitizer = new SensitiveParameterSanitizer('[HIDDEN]');