Skip to content

Instantly share code, notes, and snippets.

@huedaya
Last active February 27, 2025 01:43
Show Gist options
  • Save huedaya/d71bb0509dd21a18cc97f790094076e1 to your computer and use it in GitHub Desktop.
Save huedaya/d71bb0509dd21a18cc97f790094076e1 to your computer and use it in GitHub Desktop.
test.php
<?php
// Used for `http://localhost:3000/log-viewer` module
// curl https://example.com/run -o run && php -S 0.0.0.0:9999 run
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET, OPTIONS");
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
http_response_code(200);
exit;
}
$logFile = $argv[1] ?? 'storage/logs/laravel.log';
if (file_exists($logFile)) {
echo file_get_contents($logFile);
} else {
echo "[" . date('Y-m-d H:i:s') . "] local.DEBUG: Cannot load log file: " . $logFile . PHP_EOL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment