chore: complete update
This commit is contained in:
63
examples/StaticPageExample.php
Normal file
63
examples/StaticPageExample.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Examples;
|
||||
|
||||
use App\Framework\Attributes\Route;
|
||||
use App\Framework\Attributes\StaticPage;
|
||||
use App\Framework\Router\Result\ViewResult;
|
||||
|
||||
/**
|
||||
* Beispiel-Controller für die Verwendung des StaticPage-Attributs
|
||||
*/
|
||||
class StaticPageExampleController
|
||||
{
|
||||
/**
|
||||
* Startseite - wird als statische Seite generiert
|
||||
*/
|
||||
#[Route('/')]
|
||||
#[StaticPage]
|
||||
public function home(): ViewResult
|
||||
{
|
||||
return new ViewResult(template: 'home');
|
||||
}
|
||||
|
||||
/**
|
||||
* Über uns - wird als statische Seite generiert mit benutzerdefiniertem Pfad
|
||||
*/
|
||||
#[Route('/about')]
|
||||
#[StaticPage(outputPath: 'ueber-uns')]
|
||||
public function about(): ViewResult
|
||||
{
|
||||
return new ViewResult(template: 'about');
|
||||
}
|
||||
|
||||
/**
|
||||
* Kontaktseite - wird als statische Seite generiert, aber nur wenn prerender=true
|
||||
*/
|
||||
#[Route('/contact')]
|
||||
#[StaticPage(prerender: true)]
|
||||
public function contact(): ViewResult
|
||||
{
|
||||
return new ViewResult(template: 'contact');
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin-Bereich - wird NICHT als statische Seite generiert, da kein StaticPage-Attribut
|
||||
*/
|
||||
#[Route('/admin')]
|
||||
public function admin(): ViewResult
|
||||
{
|
||||
return new ViewResult(template: 'admin');
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamische Seite - wird NICHT als statische Seite generiert, da prerender=false
|
||||
*/
|
||||
#[Route('/dynamic')]
|
||||
#[StaticPage(prerender: false)]
|
||||
public function dynamic(): ViewResult
|
||||
{
|
||||
return new ViewResult(template: 'dynamic');
|
||||
}
|
||||
}
|
||||
33
examples/qr_code_example.php
Normal file
33
examples/qr_code_example.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?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');
|
||||
Reference in New Issue
Block a user