mache mal statistische analyse mit rein
This commit is contained in:
parent
853b280571
commit
c5fa857464
8 changed files with 444 additions and 57 deletions
64
src/App.php
Normal file
64
src/App.php
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App;
|
||||
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Uid\Ulid;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
|
||||
final readonly class App
|
||||
{
|
||||
public function __construct(
|
||||
private string $base,
|
||||
) {}
|
||||
public function handle(Request $request): Response
|
||||
{
|
||||
return match ($request->getPathInfo()) {
|
||||
'/v1' => new PlaintextResponse(Uuid::v1()->toString()),
|
||||
'/v4' => new PlaintextResponse(Uuid::v4()->toString()),
|
||||
'/v6' => new PlaintextResponse(Uuid::v6()->toString()),
|
||||
'/v7' => new PlaintextResponse(Uuid::v7()->toString()),
|
||||
'/ulid' => new PlaintextResponse(Ulid::generate()),
|
||||
'/' => new PlaintextResponse(
|
||||
<<<TXT
|
||||
UUID/ULID Webservice
|
||||
|
||||
Available Endpoints:
|
||||
/v1 - Generate a UUID v1 (time-based)
|
||||
curl {$this->base}v1
|
||||
|
||||
/v3 - Generate a UUID v3 (name-based, MD5 hash)
|
||||
curl {$this->base}v3
|
||||
|
||||
/v4 - Generate a UUID v4 (random)
|
||||
curl {$this->base}v4
|
||||
|
||||
/v5 - Generate a UUID v5 (name-based, SHA-1 hash)
|
||||
curl {$this->base}v5
|
||||
|
||||
/v6 - Generate a UUID v6 (reordered time-based)
|
||||
curl {$this->base}v6
|
||||
|
||||
/v7 - Generate a UUID v7 (Unix timestamp-based)
|
||||
curl {$this->base}v7
|
||||
|
||||
/ulid - Generate a ULID
|
||||
curl {$this->base}ulid
|
||||
|
||||
source: https://git.hannover.ccc.de/lubiana/uuid
|
||||
TXT
|
||||
),
|
||||
default => new RedirectResponse('/', 301),
|
||||
};
|
||||
}
|
||||
public function run(?Request $request = null): void
|
||||
{
|
||||
$request ??= Request::createFromGlobals();
|
||||
$response = $this->handle($request);
|
||||
$response->send();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue