34 lines
1003 B
PHP
34 lines
1003 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/../vendor/autoload.php';
|
|
|
|
use App\Application\Service\QrCodeService;
|
|
use App\Domain\QrCode\ValueObject\ErrorCorrectionLevel;
|
|
|
|
$qrCodeService = new QrCodeService();
|
|
|
|
// Einfache Verwendung
|
|
$svgContent = $qrCodeService->generateSvg('https://example.com');
|
|
file_put_contents('qr_code.svg', $svgContent);
|
|
echo "SVG-QR-Code erstellt: qr_code.svg\n";
|
|
|
|
// Mit benutzerdefinierten Einstellungen
|
|
$pngContent = $qrCodeService->generatePng(
|
|
'Hallo Welt!',
|
|
ErrorCorrectionLevel::H,
|
|
moduleSize: 6,
|
|
margin: 8
|
|
);
|
|
file_put_contents('qr_code.png', $pngContent);
|
|
echo "PNG-QR-Code erstellt: qr_code.png\n";
|
|
|
|
// Matrix direkt verwenden
|
|
$matrix = $qrCodeService->generateQrCode('Benutzerdefinierter QR-Code', ErrorCorrectionLevel::L);
|
|
echo "QR-Code Größe: " . $matrix->getSize() . "x" . $matrix->getSize() . "\n";
|
|
|
|
// Ausgabe der Matrix als Text (für Debugging)
|
|
echo "ASCII-QR-Code:\n";
|
|
echo $qrCodeService->generateAscii('https://example.com');
|