razxc / telescope
Alerting, collecting and tracking for errors in production and development
6.0.0
2026-03-29 08:23 UTC
Requires
- php: >=5.3.0
README
The tool with zero-dependencies for error alerting, collecting and tracking in stages of development and maintenance.
Install
composer require razxc/telescope cp vendor/razxc/telescope/sample.telescope.ini .telescope.ini
Usage in production mode
require_once __DIR__ . '/vendor/autoload.php'; use net\example\SiteApp; use razxc\telescope\Telescope as T; T::init(__DIR__ . '/.telescope.ini'); // Your application start... SiteApp::run();
Usage in development mode
require_once __DIR__ . '/vendor/autoload.php'; use net\example\SiteApp; use razxc\telescope\Telescope as T; T::init(__DIR__ . '/.telescope.ini', T::MODE_TRACING + T::MODE_DISPLAY + T::MODE_LOG); putenv('TELESCOPE_REPORT_URL=/.telescope-secret-page.html?nocache=' . time()); putenv('TELESCOPE_REPORT_DIR=' . __DIR__ . '/wwwroot'); putenv('TELESCOPE_REPORT_TPL=' . __DIR__ . '/vendor/razxc/telescope/src/tpls/details-page.tpl.php'); T::onShutdown(static function() { $paths = explode(PATH_SEPARATOR, get_include_path()); T::shoot($paths, 'PHP included paths'); $reportUrl = getenv('TELESCOPE_REPORT_URL'); if (!$reportUrl) { return; } $reportDir = getenv('TELESCOPE_REPORT_DIR'); $urlPath = parse_url($reportUrl, PHP_URL_PATH); $reportFile = rtrim($reportDir, '/') . '/' . basename($urlPath); if (!is_writable($reportFile)) { return; } $reportHtml = T::buildDetailReport([ 'tpl_path' => getenv('TELESCOPE_REPORT_TPL'), ]); T::shootQueries(QueryConnection::getQueriesInfo()); T::log($reportHtml, $reportFile, 'w+', false); }); // Your application start... SiteApp::runInDevMode();
Testing
cp sample.telescope.ini .telescope.ini mkdir --parent var/logs mkdir -m 755 -p ./.mail/letters && touch ./.mail/letters_num && chmod 644 ./.mail/letters_num # fake-sendmail.sh rm -rf composer.lock #composer require --dev phpunit/phpunit:10 # >= PHP 8.1 composer require --dev phpunit/phpunit:13 # >= PHP 8.4 ./vendor/bin/phpunit