This commit is contained in:
Frank
2026-01-02 20:27:56 +01:00
parent 534175efb3
commit 0d6628e7c9
45 changed files with 12279 additions and 2911 deletions

View File

@@ -0,0 +1,55 @@
<?php
declare(strict_types=1);
namespace App\Command;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Email;
#[AsCommand(
name: 'app:mail:test',
description: 'Sends a simple test email using the configured mail transport (SendGrid in prod).'
)]
final class TestEmailCommand extends Command
{
public function __construct(private readonly MailerInterface $mailer)
{
parent::__construct();
}
protected function configure(): void
{
$this
->addArgument('to', InputArgument::REQUIRED, 'Recipient email address')
->addOption('subject', null, InputOption::VALUE_REQUIRED, 'Email subject', 'EscapePage mailer test')
->addOption('from', null, InputOption::VALUE_REQUIRED, 'Sender email address (defaults to MAILER_FROM if set)')
->addOption('from-name', null, InputOption::VALUE_REQUIRED, 'Sender name', 'EscapePage');
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$to = (string) $input->getArgument('to');
$subject = (string) $input->getOption('subject');
$fromEmail = (string) ($input->getOption('from') ?? ($_ENV['MAILER_FROM'] ?? $_SERVER['MAILER_FROM'] ?? 'no-reply@example.com'));
$fromName = (string) $input->getOption('from-name');
$email = (new Email())
->from(new Address($fromEmail, $fromName))
->to($to)
->subject($subject)
->html('<p>This is a test email sent at ' . date('c') . '.</p><p>If you see this, your mailer setup works.</p>')
->text('This is a test email sent at ' . date('c') . ". If you see this, your mailer setup works.");
$this->mailer->send($email);
$output->writeln('<info>Test email sent to ' . $to . '.</info>');
return Command::SUCCESS;
}
}

View File

View File

View File

@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
namespace App\Game\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
final class HubController extends AbstractController
{
#[Route(path: '', name: 'game_hub')]
public function index(): Response
{
return $this->render('game/hub/index.html.twig');
}
}

View File

View File

@@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace App\Website\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
final class HomeController extends AbstractController
{
#[Route(path: '', name: 'website_home')]
public function index(): Response
{
return $this->render(
'website/home/index.html.twig');
}
}