1. Go to this page and download the library: Download chevere/xr 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/ */
use Chevere\xrDebug\PHP\registerThrowableHandler;
// True append xrDebug to your existing handler
// False use only xrDebug handler
registerThrowableHandler(true);
use Chevere\ThrowableHandler\ThrowableHandler;
set_error_handler(
ThrowableHandler::ERROR_AS_EXCEPTION
);
register_shutdown_function(
ThrowableHandler::SHUTDOWN_ERROR_AS_EXCEPTION
);
use Chevere\xrDebug\PHP\Traits\XrInspectorNullTrait;
use Chevere\xrDebug\PHP\Interfaces\XrInspectorInterface;
class MyInspectorNull implements XrInspectorInterface
{
use XrInspectorNullTrait;
public function myDump(
string $t = '',
string $e = '',
int $f = 0,
): void {
}
public function myPause(
int $f = XR_DEBUG_BACKTRACE,
): void {
}
}
use Chevere\xrDebug\PHP\XrInspectorInstance;
use Chevere\xrDebug\PHP\Interfaces\XrInspectorInterface;
use LogicException;
use MyInspector;
use MyInspectorNull;
function my_inspector(): MyInspector
{
try {
return XrInspectorInstance::get();
} catch (LogicException) {
$inspector = getXr()->enable()
? MyInspector::class
: MyInspectorNull::class;
$client = getXr()->client();
$inspector = new $inspector($client);
$instance = new XrInspectorInstance($inspector);
return $instance::get();
}
}