start rework for 2025

This commit is contained in:
lubiana 2025-07-08 22:30:04 +02:00
parent f5c444d4c7
commit 3473429f58
Signed by: lubiana
SSH key fingerprint: SHA256:vW1EA0fRR3Fw+dD/sM0K+x3Il2gSry6YRYHqOeQwrfk
14 changed files with 214 additions and 1589 deletions

View file

@ -1,27 +1,38 @@
<?php declare(strict_types=1);
<?php
namespace Lubian\NoFramework;
declare(strict_types=1);
namespace Lubiana\NoFramework;
use Throwable;
use Whoops\Handler\CallbackHandler;
use Whoops\Handler\PrettyPageHandler;
use Whoops\Run;
require __DIR__ . '/../vendor/autoload.php';
$environment = getenv('ENVIRONMENT') ?: 'dev';
$environment = getenv('APP_ENV') ?: 'dev';
error_reporting(E_ALL);
$whoops = new Run();
$whoops = new Run;
$whoops->pushHandler(
new CallbackHandler(
function (Throwable $e) use ($environment) {
if ($environment !== 'dev') {
http_response_code(500);
echo 'Whoops';
}
error_log(<<<TXT
Error: {$e->getMessage()}
{$e->getTraceAsString()}
TXT
);
}
)
);
if ($environment === 'dev') {
$whoops->pushHandler(new PrettyPageHandler());
} else {
$whoops->pushHandler(function (\Throwable $t) {
error_log('ERROR: ' . $t->getMessage(), $t->getCode());
echo 'Oooopsie';
});
$whoops->pushHandler(new PrettyPageHandler);
}
$whoops->register();
echo 'Hello World!';
throw new \Exception('Hello world');