start rework for 2025

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

View file

@ -1,5 +1,7 @@
{
"name": "lubiana/no-framework",
"type": "project",
"license": "MIT",
"autoload": {
"psr-4": {
"Lubiana\\NoFramework\\": "src/"
@ -7,12 +9,12 @@
},
"authors": [
{
"name": "example",
"email": "test@example.com"
"name": "lubiana",
"email": "lubiana@hannover.ccc.de"
}
],
"require": {
"php": ">=8.1",
"filp/whoops": "^2.14"
"php": "^8.4",
"filp/whoops": "^2.18"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View file

@ -1,3 +1,5 @@
<?php declare(strict_types=1);
<?php
require __DIR__ . '/../src/Bootstrap.php';
declare(strict_types=1);
require __DIR__ . '/../src/Bootstrap.php';

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');