Bläddra i källkod

improving mail sending. implementing pdf creation. temp added composer..

Medowar 1 månad sedan
förälder
incheckning
5926c55573

+ 1 - 0
.gitignore

@@ -1,5 +1,6 @@
 config/app.local.php
 config/mail.local.php
+composer.phar
 storage/rate_limit/*.json
 storage/locks/*.lock
 storage/logs/*.log

+ 1 - 1
.htaccess

@@ -7,7 +7,7 @@ RewriteEngine On
 RewriteRule "(^|/)\." - [F,L]
 
 # Block internal directories from public access
-RewriteRule "^(config|src|storage|bin|docs)(/|$)" - [F,L,NC]
+RewriteRule "^(config|src|storage|bin|docs|vendor)(/|$)" - [F,L,NC]
 
 # Keep direct file-based endpoints, fallback unknown routes to index
 RewriteCond %{REQUEST_FILENAME} !-f

+ 7 - 9
TODO.md

@@ -1,14 +1,5 @@
 Offene Themen:
 
-- Mail
-Mail Antrag an Antragsteller
-
-Mail Vorstand/Verwaltung:
-- Anhänge
-- Formatierung der Daten verbessern
-
-Mail Zustellung mehrere Empfänger
-
 Admin Interface
 Überarbeiten
 
@@ -16,3 +7,10 @@ User-Interface nach Antrag:
 Zusammenfassung anzeigen
 
 Storage-Handling nach Einreichen checken
+
+Erledigte Themen:
+
+- Mail: Antragsteller erhält HTML-Mail mit vollständiger Datenzusammenfassung und Upload-Liste
+- Mail: Vorstand/Verwaltung erhält HTML-Mail mit allen Daten, zwei PDF-Anhänge (Antragsdaten + Anlagen)
+- Mail: Formatierung verbessert (Labels statt Feldnamen, Datumsformat, Ja/Nein, Tabellen)
+- Mail: Zustellung an mehrere Empfänger (PHPMailer, je Empfänger eigene Mail)

+ 149 - 0
bin/test-mail.php

@@ -0,0 +1,149 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * Test script for the mail system. Run from CLI:
+ *   php bin/test-mail.php
+ *
+ * Generates PDFs and HTML output to verify formatting without sending emails.
+ */
+
+require dirname(__DIR__) . '/src/autoload.php';
+
+use App\App\Bootstrap;
+use App\Form\FormSchema;
+use App\Mail\SubmissionFormatter;
+use App\Mail\PdfGenerator;
+use App\Mail\Mailer;
+
+Bootstrap::init(false);
+
+$submission = [
+    'email' => 'max.mustermann@example.org',
+    'application_key' => 'test_' . bin2hex(random_bytes(8)),
+    'status' => 'submitted',
+    'submitted_at' => date('c'),
+    'form_data' => [
+        'vorname' => 'Max',
+        'nachname' => 'Mustermann',
+        'geburtsdatum' => '1990-05-15',
+        'strasse' => 'Musterstraße 42',
+        'plz' => '85354',
+        'ort' => 'Freising',
+        'telefon' => '01701234567',
+        'job' => 'Softwareentwickler',
+        'pate' => 'Hans Meier',
+        'mitgliedsart' => 'Aktiv',
+        'qualifikation_vorhanden' => 'ja',
+        'führerschein_vorhanden' => 'b',
+        'führerschein_nachweis' => 'Staplerführerschein',
+        'bisherige_dienstzeiten' => "Feuerwehr/Hilfsorganisation,von,bis\nFF Moosburg,2015-03-01,2020-12-31\nTHW OV Freising,2021-01-15,2023-06-30",
+        'letzter_dienstgrad' => 'Oberfeuerwehrmann',
+        'basismodul' => '1',
+        'truppführer' => '1',
+        'gruppenführer' => '',
+        'atemschutzgeräteträger' => '1',
+        'gültige_g26' => '1',
+        'motorsägenführer' => '',
+        'feuerwehrsanitäter' => '1',
+        'weitere_lehrgaenge' => 'Erste Hilfe Ausbilder',
+        'abzeichen_lösch' => '3',
+        'abzeichen_thl' => '2',
+        'freier_kommentar' => 'Ich freue mich auf die Zusammenarbeit.',
+        'körperliche_eignung' => '1',
+        'schwimmer' => '1',
+        'einwilligung_datenschutz' => '1',
+        'einwilligung_bildrechte' => '1',
+    ],
+    'uploads' => [
+        'portraitfoto' => [
+            [
+                'original_filename' => 'bewerbungsfoto.jpg',
+                'stored_dir' => 'test/portraitfoto/abc12345',
+                'stored_filename' => 'bewerbungsfoto.jpg',
+                'relative_path' => 'test/portraitfoto/abc12345/bewerbungsfoto.jpg',
+                'mime' => 'image/jpeg',
+                'size' => 150000,
+            ],
+        ],
+        'qualifikationsnachweise' => [
+            [
+                'original_filename' => 'nachweis_truppfuehrer.pdf',
+                'stored_dir' => 'test/qualifikationsnachweise/def67890',
+                'stored_filename' => 'nachweis_truppfuehrer.pdf',
+                'relative_path' => 'test/qualifikationsnachweise/def67890/nachweis_truppfuehrer.pdf',
+                'mime' => 'application/pdf',
+                'size' => 250000,
+            ],
+        ],
+    ],
+];
+
+echo "=== Testing SubmissionFormatter ===\n\n";
+
+$schema = new FormSchema();
+$formatter = new SubmissionFormatter($schema);
+
+$steps = $formatter->getFormattedSteps($submission['form_data']);
+foreach ($steps as $step) {
+    echo "--- " . $step['title'] . " ---\n";
+    foreach ($step['fields'] as $field) {
+        echo "  " . $field['label'] . ": " . $field['value'] . "\n";
+    }
+    echo "\n";
+}
+
+$uploads = $formatter->getUploadSummary($submission['uploads']);
+echo "--- Uploads ---\n";
+foreach ($uploads as $u) {
+    echo "  " . $u['label'] . ": " . $u['filename'] . "\n";
+}
+
+echo "\n=== Testing PdfGenerator (Form Data PDF) ===\n\n";
+
+$pdfGen = new PdfGenerator($formatter, $schema);
+$formPdf = $pdfGen->generateFormDataPdf($submission);
+if ($formPdf !== null) {
+    echo "Form data PDF generated: " . $formPdf . " (" . filesize($formPdf) . " bytes)\n";
+    $outputDir = dirname(__DIR__) . '/storage/logs';
+    $copyPath = $outputDir . '/test_antragsdaten.pdf';
+    copy($formPdf, $copyPath);
+    echo "Copied to: " . $copyPath . "\n";
+    unlink($formPdf);
+} else {
+    echo "ERROR: Form data PDF generation failed.\n";
+}
+
+echo "\n=== Testing PdfGenerator (Attachments PDF) ===\n";
+echo "(Expected: null or partial - test files don't exist on disk)\n\n";
+
+$attPdf = $pdfGen->generateAttachmentsPdf($submission);
+if ($attPdf !== null) {
+    echo "Attachments PDF generated: " . $attPdf . " (" . filesize($attPdf) . " bytes)\n";
+    unlink($attPdf);
+} else {
+    echo "No attachments PDF (expected: test upload files don't exist on disk).\n";
+}
+
+echo "\n=== Testing Mailer HTML Rendering ===\n\n";
+
+$mailer = new Mailer();
+$ref = new \ReflectionClass($mailer);
+
+$adminMethod = $ref->getMethod('renderAdminHtml');
+$adminMethod->setAccessible(true);
+$adminHtml = $adminMethod->invoke($mailer, $submission, true, true);
+
+$outputDir = dirname(__DIR__) . '/storage/logs';
+file_put_contents($outputDir . '/test_admin_email.html', $adminHtml);
+echo "Admin HTML saved to: " . $outputDir . "/test_admin_email.html\n";
+
+$applicantMethod = $ref->getMethod('renderApplicantHtml');
+$applicantMethod->setAccessible(true);
+$applicantHtml = $applicantMethod->invoke($mailer, $submission);
+
+file_put_contents($outputDir . '/test_applicant_email.html', $applicantHtml);
+echo "Applicant HTML saved to: " . $outputDir . "/test_applicant_email.html\n";
+
+echo "\nDone. Check the generated files in storage/logs/.\n";

+ 15 - 0
composer.json

@@ -0,0 +1,15 @@
+{
+    "name": "feuerwehr-freising/mitgliedsantrag",
+    "description": "Digitaler Mitgliedsantrag für den Feuerwehrverein Freising",
+    "type": "project",
+    "require": {
+        "php": ">=8.1",
+        "phpmailer/phpmailer": "^6.9",
+        "tecnickcom/tcpdf": "^6.7",
+        "setasign/fpdi": "^2.6"
+    },
+    "config": {
+        "optimize-autoloader": true,
+        "sort-packages": true
+    }
+}

+ 245 - 0
composer.lock

@@ -0,0 +1,245 @@
+{
+    "_readme": [
+        "This file locks the dependencies of your project to a known state",
+        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+        "This file is @generated automatically"
+    ],
+    "content-hash": "c4d2c538d2df0a0f21bbe8fb0b8f7609",
+    "packages": [
+        {
+            "name": "phpmailer/phpmailer",
+            "version": "v6.12.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/PHPMailer/PHPMailer.git",
+                "reference": "d1ac35d784bf9f5e61b424901d5a014967f15b12"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/d1ac35d784bf9f5e61b424901d5a014967f15b12",
+                "reference": "d1ac35d784bf9f5e61b424901d5a014967f15b12",
+                "shasum": ""
+            },
+            "require": {
+                "ext-ctype": "*",
+                "ext-filter": "*",
+                "ext-hash": "*",
+                "php": ">=5.5.0"
+            },
+            "require-dev": {
+                "dealerdirect/phpcodesniffer-composer-installer": "^1.0",
+                "doctrine/annotations": "^1.2.6 || ^1.13.3",
+                "php-parallel-lint/php-console-highlighter": "^1.0.0",
+                "php-parallel-lint/php-parallel-lint": "^1.3.2",
+                "phpcompatibility/php-compatibility": "^9.3.5",
+                "roave/security-advisories": "dev-latest",
+                "squizlabs/php_codesniffer": "^3.7.2",
+                "yoast/phpunit-polyfills": "^1.0.4"
+            },
+            "suggest": {
+                "decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication",
+                "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses",
+                "ext-openssl": "Needed for secure SMTP sending and DKIM signing",
+                "greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication",
+                "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
+                "league/oauth2-google": "Needed for Google XOAUTH2 authentication",
+                "psr/log": "For optional PSR-3 debug logging",
+                "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)",
+                "thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "PHPMailer\\PHPMailer\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "LGPL-2.1-only"
+            ],
+            "authors": [
+                {
+                    "name": "Marcus Bointon",
+                    "email": "phpmailer@synchromedia.co.uk"
+                },
+                {
+                    "name": "Jim Jagielski",
+                    "email": "jimjag@gmail.com"
+                },
+                {
+                    "name": "Andy Prevost",
+                    "email": "codeworxtech@users.sourceforge.net"
+                },
+                {
+                    "name": "Brent R. Matzelle"
+                }
+            ],
+            "description": "PHPMailer is a full-featured email creation and transfer class for PHP",
+            "support": {
+                "issues": "https://github.com/PHPMailer/PHPMailer/issues",
+                "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.12.0"
+            },
+            "funding": [
+                {
+                    "url": "https://github.com/Synchro",
+                    "type": "github"
+                }
+            ],
+            "time": "2025-10-15T16:49:08+00:00"
+        },
+        {
+            "name": "setasign/fpdi",
+            "version": "v2.6.4",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/Setasign/FPDI.git",
+                "reference": "4b53852fde2734ec6a07e458a085db627c60eada"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/Setasign/FPDI/zipball/4b53852fde2734ec6a07e458a085db627c60eada",
+                "reference": "4b53852fde2734ec6a07e458a085db627c60eada",
+                "shasum": ""
+            },
+            "require": {
+                "ext-zlib": "*",
+                "php": "^7.1 || ^8.0"
+            },
+            "conflict": {
+                "setasign/tfpdf": "<1.31"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^7",
+                "setasign/fpdf": "~1.8.6",
+                "setasign/tfpdf": "~1.33",
+                "squizlabs/php_codesniffer": "^3.5",
+                "tecnickcom/tcpdf": "^6.8"
+            },
+            "suggest": {
+                "setasign/fpdf": "FPDI will extend this class but as it is also possible to use TCPDF or tFPDF as an alternative. There's no fixed dependency configured."
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "setasign\\Fpdi\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Jan Slabon",
+                    "email": "jan.slabon@setasign.com",
+                    "homepage": "https://www.setasign.com"
+                },
+                {
+                    "name": "Maximilian Kresse",
+                    "email": "maximilian.kresse@setasign.com",
+                    "homepage": "https://www.setasign.com"
+                }
+            ],
+            "description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.",
+            "homepage": "https://www.setasign.com/fpdi",
+            "keywords": [
+                "fpdf",
+                "fpdi",
+                "pdf"
+            ],
+            "support": {
+                "issues": "https://github.com/Setasign/FPDI/issues",
+                "source": "https://github.com/Setasign/FPDI/tree/v2.6.4"
+            },
+            "funding": [
+                {
+                    "url": "https://tidelift.com/funding/github/packagist/setasign/fpdi",
+                    "type": "tidelift"
+                }
+            ],
+            "time": "2025-08-05T09:57:14+00:00"
+        },
+        {
+            "name": "tecnickcom/tcpdf",
+            "version": "6.11.2",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/tecnickcom/TCPDF.git",
+                "reference": "e1e2ade18e574e963473f53271591edd8c0033ec"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/e1e2ade18e574e963473f53271591edd8c0033ec",
+                "reference": "e1e2ade18e574e963473f53271591edd8c0033ec",
+                "shasum": ""
+            },
+            "require": {
+                "ext-curl": "*",
+                "php": ">=7.1.0"
+            },
+            "type": "library",
+            "autoload": {
+                "classmap": [
+                    "config",
+                    "include",
+                    "tcpdf.php",
+                    "tcpdf_barcodes_1d.php",
+                    "tcpdf_barcodes_2d.php",
+                    "include/tcpdf_colors.php",
+                    "include/tcpdf_filters.php",
+                    "include/tcpdf_font_data.php",
+                    "include/tcpdf_fonts.php",
+                    "include/tcpdf_images.php",
+                    "include/tcpdf_static.php",
+                    "include/barcodes/datamatrix.php",
+                    "include/barcodes/pdf417.php",
+                    "include/barcodes/qrcode.php"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "LGPL-3.0-or-later"
+            ],
+            "authors": [
+                {
+                    "name": "Nicola Asuni",
+                    "email": "info@tecnick.com",
+                    "role": "lead"
+                }
+            ],
+            "description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
+            "homepage": "http://www.tcpdf.org/",
+            "keywords": [
+                "PDFD32000-2008",
+                "TCPDF",
+                "barcodes",
+                "datamatrix",
+                "pdf",
+                "pdf417",
+                "qrcode"
+            ],
+            "support": {
+                "issues": "https://github.com/tecnickcom/TCPDF/issues",
+                "source": "https://github.com/tecnickcom/TCPDF/tree/6.11.2"
+            },
+            "funding": [
+                {
+                    "url": "https://www.paypal.com/donate/?hosted_button_id=NZUEC5XS8MFBJ",
+                    "type": "custom"
+                }
+            ],
+            "time": "2026-03-03T08:58:10+00:00"
+        }
+    ],
+    "packages-dev": [],
+    "aliases": [],
+    "minimum-stability": "stable",
+    "stability-flags": {},
+    "prefer-stable": false,
+    "prefer-lowest": false,
+    "platform": {
+        "php": ">=8.1"
+    },
+    "platform-dev": {},
+    "plugin-api-version": "2.9.0"
+}

+ 1 - 0
config/mail.sample.php

@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 return [
     'from' => 'antrag@example.org',
+    'from_name' => 'Feuerwehr Freising - Mitgliedsantrag',
     'recipients' => [
         'verein@example.org',
     ],

+ 11 - 1
docs/AI_OVERVIEW.md

@@ -31,7 +31,9 @@ Digitaler Mitgliedsantrag für Feuerwehrverein mit Flatfile-Speicherung und Admi
   - `src/Form/Validator.php`
   - `src/Security/Csrf.php`
   - `src/Security/RateLimiter.php`
-  - `src/Mail/Mailer.php`
+  - `src/Mail/Mailer.php` (PHPMailer-basiert, HTML-Mails + PDF-Anhänge)
+  - `src/Mail/PdfGenerator.php` (TCPDF/FPDI, erzeugt Antrags- und Anlagen-PDFs)
+  - `src/Mail/SubmissionFormatter.php` (Formatierung der Formulardaten für Mail/PDF)
 
 ## Datenfluss
 
@@ -55,12 +57,20 @@ Digitaler Mitgliedsantrag für Feuerwehrverein mit Flatfile-Speicherung und Admi
 - Upload-Typen/Limits: `config/app.local.php` + optional pro Feld im Schema
 - Admin-Session/Login: `config/app.local.php` + `src/Admin/Auth.php`
 - Mailtexte/Empfänger: `config/mail.local.php` + `src/Mail/Mailer.php`
+- PDF-Erzeugung/Layout: `src/Mail/PdfGenerator.php`
 - Retention-Tage: `config/app.local.php` + Cron `bin/cleanup.php`
 - Rate-Limit-Parameter: `config/app.local.php -> rate_limit` (Details: `docs/RATE_LIMITING.md`)
 - Disclaimer-Startseite: `config/app.local.php -> disclaimer` + `index.php`
 - Versionskontrollierte Config-Vorlagen: `config/app.sample.php`, `config/mail.sample.php`
 - Lokale Runtime-Configs (nicht versioniert): `config/app.local.php`, `config/mail.local.php`
 
+## Abhängigkeiten (Composer)
+
+- `phpmailer/phpmailer` — HTML-Mails mit MIME-Multipart und PDF-Anhängen.
+- `tecnickcom/tcpdf` — PDF-Erzeugung (Formulardaten, Bild-Einbettung).
+- `setasign/fpdi` — Import bestehender PDF-Seiten in kombinierte Anlagen-PDFs.
+- `vendor/` wird committed (kein Composer-CLI auf Shared Hosting).
+
 ## Harte Regeln
 
 - Ein Antrag pro E-Mail (Submission blockiert weitere Anträge).

+ 10 - 0
docs/OPERATIONS.md

@@ -63,6 +63,16 @@ Regelmäßig sichern:
 3. `config/*.local.php` wiederherstellen.
 4. Schreibrechte prüfen.
 
+## Abhängigkeiten aktualisieren
+
+`vendor/` ist committed. Bei Änderungen an `composer.json`:
+
+```bash
+php composer.phar install --optimize-autoloader --ignore-platform-reqs
+```
+
+Falls `composer.phar` nicht vorhanden: `php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && php composer-setup.php && rm composer-setup.php`
+
 ## Troubleshooting
 
 - Keine Mails: Mailfunktion des Hosters prüfen, `mail.log` ansehen.

+ 388 - 53
src/Mail/Mailer.php

@@ -5,106 +5,441 @@ declare(strict_types=1);
 namespace App\Mail;
 
 use App\App\Bootstrap;
+use App\Form\FormSchema;
+use PHPMailer\PHPMailer\PHPMailer;
 
 final class Mailer
 {
     /** @var array<string, mixed> */
     private array $mailConfig;
+    private SubmissionFormatter $formatter;
+    private PdfGenerator $pdfGenerator;
+    private FormSchema $schema;
 
     public function __construct()
     {
         $this->mailConfig = Bootstrap::config('mail');
+        $this->schema = new FormSchema();
+        $this->formatter = new SubmissionFormatter($this->schema);
+        $this->pdfGenerator = new PdfGenerator($this->formatter, $this->schema);
     }
 
     /** @param array<string, mixed> $submission */
     public function sendSubmissionMails(array $submission): void
     {
-        $email = (string) ($submission['email'] ?? '');
+        $formDataPdf = null;
+        $attachmentsPdf = null;
+
+        try {
+            $formDataPdf = $this->pdfGenerator->generateFormDataPdf($submission);
+            $attachmentsPdf = $this->pdfGenerator->generateAttachmentsPdf($submission);
 
-        $subjectAdmin = (string) ($this->mailConfig['subjects']['admin'] ?? 'Neuer Mitgliedsantrag');
-        $subjectUser = (string) ($this->mailConfig['subjects']['applicant'] ?? 'Bestätigung Mitgliedsantrag');
+            $this->sendAdminMails($submission, $formDataPdf, $attachmentsPdf);
+            $this->sendApplicantMail($submission);
+        } finally {
+            if ($formDataPdf !== null && is_file($formDataPdf)) {
+                @unlink($formDataPdf);
+            }
+            if ($attachmentsPdf !== null && is_file($attachmentsPdf)) {
+                @unlink($attachmentsPdf);
+            }
+        }
+    }
 
-        $adminBody = $this->renderAdminBody($submission);
-        $userBody = $this->renderUserBody($submission);
+    private function sendAdminMails(array $submission, ?string $formDataPdf, ?string $attachmentsPdf): void
+    {
+        $recipients = $this->mailConfig['recipients'] ?? [];
+        if (!is_array($recipients)) {
+            return;
+        }
 
-        $headers = $this->defaultHeaders();
+        $subject = (string) ($this->mailConfig['subjects']['admin'] ?? 'Neuer Mitgliedsantrag');
+        $htmlBody = $this->renderAdminHtml($submission, $formDataPdf !== null, $attachmentsPdf !== null);
+        $textBody = $this->renderAdminText($submission);
 
-        foreach (($this->mailConfig['recipients'] ?? []) as $recipient) {
+        foreach ($recipients as $recipient) {
             if (!is_string($recipient) || $recipient === '') {
                 continue;
             }
-            $ok = @mail($recipient, $subjectAdmin, $adminBody, $headers);
-            if (!$ok) {
-                Bootstrap::log('mail', 'Versand an Admin fehlgeschlagen: ' . $recipient);
+
+            try {
+                $mail = $this->createMailer();
+                $mail->addAddress($recipient);
+                $mail->Subject = $subject;
+                $mail->isHTML(true);
+                $mail->Body = $htmlBody;
+                $mail->AltBody = $textBody;
+                $mail->CharSet = 'UTF-8';
+
+                $name = $this->applicantName($submission);
+                if ($formDataPdf !== null && is_file($formDataPdf)) {
+                    $mail->addAttachment($formDataPdf, 'Antragsdaten_' . $this->safeFilenameSegment($name) . '.pdf');
+                }
+                if ($attachmentsPdf !== null && is_file($attachmentsPdf)) {
+                    $mail->addAttachment($attachmentsPdf, 'Anlagen_' . $this->safeFilenameSegment($name) . '.pdf');
+                }
+
+                if (!$mail->send()) {
+                    Bootstrap::log('mail', 'Versand an Admin fehlgeschlagen: ' . $recipient . ' - ' . $mail->ErrorInfo);
+                }
+            } catch (\Throwable $e) {
+                Bootstrap::log('mail', 'Versand an Admin fehlgeschlagen: ' . $recipient . ' - ' . $e->getMessage());
             }
         }
+    }
 
-        if ($email !== '') {
-            $okUser = @mail($email, $subjectUser, $userBody, $headers);
-            if (!$okUser) {
-                Bootstrap::log('mail', 'Versand an Antragsteller fehlgeschlagen: ' . $email);
+    private function sendApplicantMail(array $submission): void
+    {
+        $email = (string) ($submission['email'] ?? '');
+        if ($email === '') {
+            return;
+        }
+
+        $subject = (string) ($this->mailConfig['subjects']['applicant'] ?? 'Bestätigung Mitgliedsantrag');
+        $htmlBody = $this->renderApplicantHtml($submission);
+        $textBody = $this->renderApplicantText($submission);
+
+        try {
+            $mail = $this->createMailer();
+            $mail->addAddress($email);
+            $mail->Subject = $subject;
+            $mail->isHTML(true);
+            $mail->Body = $htmlBody;
+            $mail->AltBody = $textBody;
+            $mail->CharSet = 'UTF-8';
+
+            if (!$mail->send()) {
+                Bootstrap::log('mail', 'Versand an Antragsteller fehlgeschlagen: ' . $email . ' - ' . $mail->ErrorInfo);
             }
+        } catch (\Throwable $e) {
+            Bootstrap::log('mail', 'Versand an Antragsteller fehlgeschlagen: ' . $email . ' - ' . $e->getMessage());
         }
     }
 
-    /** @param array<string, mixed> $submission */
-    private function renderAdminBody(array $submission): string
+    private function createMailer(): PHPMailer
+    {
+        $mail = new PHPMailer(true);
+        $mail->isMail();
+        $mail->CharSet = 'UTF-8';
+        $mail->Encoding = 'base64';
+
+        $from = (string) ($this->mailConfig['from'] ?? 'no-reply@example.org');
+        $fromName = (string) ($this->mailConfig['from_name'] ?? '');
+        $mail->setFrom($from, $fromName);
+
+        return $mail;
+    }
+
+    // ─── Admin HTML ────────────────────────────────────────────────
+
+    private function renderAdminHtml(array $submission, bool $hasFormPdf, bool $hasAttachmentsPdf): string
+    {
+        $formData = (array) ($submission['form_data'] ?? []);
+        $uploads = (array) ($submission['uploads'] ?? []);
+        $email = $this->esc((string) ($submission['email'] ?? ''));
+        $submittedAt = $this->esc($this->formatDateTime((string) ($submission['submitted_at'] ?? '')));
+        $name = $this->esc($this->applicantName($submission));
+
+        $steps = $this->formatter->getFormattedSteps($formData);
+        $uploadSummary = $this->formatter->getUploadSummary($uploads);
+
+        $html = $this->htmlHead();
+        $html .= '<div style="max-width:700px;margin:0 auto;font-family:Arial,Helvetica,sans-serif;font-size:14px;color:#222;">';
+
+        $html .= '<div style="background:#b40000;color:#fff;padding:16px 20px;border-radius:6px 6px 0 0;">';
+        $html .= '<h1 style="margin:0;font-size:20px;">Neuer Mitgliedsantrag</h1>';
+        $html .= '</div>';
+
+        $html .= '<div style="background:#f9f9f9;padding:16px 20px;border:1px solid #ddd;border-top:none;">';
+        $html .= '<table style="font-size:14px;" cellpadding="2" cellspacing="0">';
+        $html .= '<tr><td style="font-weight:bold;padding-right:12px;">Name:</td><td>' . $name . '</td></tr>';
+        $html .= '<tr><td style="font-weight:bold;padding-right:12px;">E-Mail:</td><td>' . $email . '</td></tr>';
+        $html .= '<tr><td style="font-weight:bold;padding-right:12px;">Eingereicht am:</td><td>' . $submittedAt . '</td></tr>';
+        $html .= '</table>';
+        $html .= '</div>';
+
+        foreach ($steps as $step) {
+            $html .= $this->renderStepHtml($step, $formData);
+        }
+
+        if ($uploadSummary !== []) {
+            $html .= '<div style="margin-top:16px;padding:12px 20px;background:#f0f0f0;border:1px solid #ddd;border-radius:4px;">';
+            $html .= '<h2 style="margin:0 0 8px;font-size:15px;color:#333;">Hochgeladene Dateien</h2>';
+            $html .= '<ul style="margin:0;padding-left:20px;">';
+            foreach ($uploadSummary as $upload) {
+                $html .= '<li style="margin-bottom:4px;"><strong>' . $this->esc($upload['label']) . ':</strong> '
+                    . $this->esc($upload['filename']) . '</li>';
+            }
+            $html .= '</ul>';
+            $html .= '</div>';
+        }
+
+        if ($hasFormPdf || $hasAttachmentsPdf) {
+            $parts = [];
+            if ($hasFormPdf) {
+                $parts[] = 'Antragsdaten als PDF';
+            }
+            if ($hasAttachmentsPdf) {
+                $parts[] = 'alle Anlagen als PDF';
+            }
+            $html .= '<div style="margin-top:16px;padding:12px 20px;background:#fff3cd;border:1px solid #ffc107;border-radius:4px;font-size:13px;">';
+            $html .= '<strong>Anhänge:</strong> Im Anhang dieser E-Mail finden Sie ' . implode(' sowie ', $parts) . '.';
+            $html .= '</div>';
+        }
+
+        $html .= '</div>';
+        $html .= $this->htmlFoot();
+
+        return $html;
+    }
+
+    private function renderAdminText(array $submission): string
     {
+        $formData = (array) ($submission['form_data'] ?? []);
+        $uploads = (array) ($submission['uploads'] ?? []);
+        $email = (string) ($submission['email'] ?? '');
+        $submittedAt = $this->formatDateTime((string) ($submission['submitted_at'] ?? ''));
+        $name = $this->applicantName($submission);
+
+        $steps = $this->formatter->getFormattedSteps($formData);
+        $uploadSummary = $this->formatter->getUploadSummary($uploads);
+
         $lines = [];
-        $lines[] = "Neuer Mitgliedsantrag eingegangen";
-        $lines[] = 'E-Mail: ' . (string) ($submission['email'] ?? '');
-        $lines[] = 'Eingereicht am: ' . (string) ($submission['submitted_at'] ?? '');
+        $lines[] = 'NEUER MITGLIEDSANTRAG';
+        $lines[] = str_repeat('=', 40);
         $lines[] = '';
-        $lines[] = 'Formulardaten:';
+        $lines[] = 'Name: ' . $name;
+        $lines[] = 'E-Mail: ' . $email;
+        $lines[] = 'Eingereicht am: ' . $submittedAt;
+
+        foreach ($steps as $step) {
+            $lines[] = '';
+            $lines[] = strtoupper($step['title']);
+            $lines[] = str_repeat('-', 40);
+            foreach ($step['fields'] as $field) {
+                $lines[] = $field['label'] . ': ' . $field['value'];
+            }
+        }
+
+        if ($uploadSummary !== []) {
+            $lines[] = '';
+            $lines[] = 'HOCHGELADENE DATEIEN';
+            $lines[] = str_repeat('-', 40);
+            foreach ($uploadSummary as $upload) {
+                $lines[] = '- ' . $upload['label'] . ': ' . $upload['filename'];
+            }
+        }
+
+        return implode("\n", $lines);
+    }
+
+    // ─── Applicant HTML ────────────────────────────────────────────
+
+    private function renderApplicantHtml(array $submission): string
+    {
+        $formData = (array) ($submission['form_data'] ?? []);
+        $uploads = (array) ($submission['uploads'] ?? []);
+        $email = $this->esc((string) ($submission['email'] ?? ''));
+        $submittedAt = $this->esc($this->formatDateTime((string) ($submission['submitted_at'] ?? '')));
+        $name = $this->esc($this->applicantName($submission));
 
-        foreach ((array) ($submission['form_data'] ?? []) as $key => $value) {
-            $lines[] = '- ' . $key . ': ' . (is_scalar($value) ? (string) $value : json_encode($value));
+        $steps = $this->formatter->getFormattedSteps($formData);
+        $uploadSummary = $this->formatter->getUploadSummary($uploads);
+
+        $app = Bootstrap::config('app');
+        $contactEmail = $this->esc((string) ($app['contact_email'] ?? ''));
+
+        $html = $this->htmlHead();
+        $html .= '<div style="max-width:700px;margin:0 auto;font-family:Arial,Helvetica,sans-serif;font-size:14px;color:#222;">';
+
+        $html .= '<div style="background:#b40000;color:#fff;padding:16px 20px;border-radius:6px 6px 0 0;">';
+        $html .= '<h1 style="margin:0;font-size:20px;">Bestätigung Ihres Mitgliedsantrags</h1>';
+        $html .= '</div>';
+
+        $html .= '<div style="background:#f9f9f9;padding:16px 20px;border:1px solid #ddd;border-top:none;">';
+        $html .= '<p style="margin:0 0 12px;">Vielen Dank für Ihren Mitgliedsantrag bei der Freiwilligen Feuerwehr Freising.</p>';
+        $html .= '<p style="margin:0;">Ihre Daten wurden am <strong>' . $submittedAt . '</strong> erfolgreich übermittelt. ';
+        $html .= 'Nachfolgend finden Sie eine Zusammenfassung Ihrer Angaben.</p>';
+        $html .= '</div>';
+
+        foreach ($steps as $step) {
+            $html .= $this->renderStepHtml($step, $formData);
+        }
+
+        if ($uploadSummary !== []) {
+            $html .= '<div style="margin-top:16px;padding:12px 20px;background:#f0f0f0;border:1px solid #ddd;border-radius:4px;">';
+            $html .= '<h2 style="margin:0 0 8px;font-size:15px;color:#333;">Ihre hochgeladenen Dateien</h2>';
+            $html .= '<ul style="margin:0;padding-left:20px;">';
+            foreach ($uploadSummary as $upload) {
+                $html .= '<li style="margin-bottom:4px;"><strong>' . $this->esc($upload['label']) . ':</strong> '
+                    . $this->esc($upload['filename']) . '</li>';
+            }
+            $html .= '</ul>';
+            $html .= '</div>';
         }
 
+        if ($contactEmail !== '') {
+            $html .= '<div style="margin-top:20px;padding:12px 20px;background:#e8f4f8;border:1px solid #b8d4e3;border-radius:4px;font-size:13px;">';
+            $html .= 'Bei Rückfragen wenden Sie sich bitte an <a href="mailto:' . $contactEmail . '">' . $contactEmail . '</a>.';
+            $html .= '</div>';
+        }
+
+        $html .= '</div>';
+        $html .= $this->htmlFoot();
+
+        return $html;
+    }
+
+    private function renderApplicantText(array $submission): string
+    {
+        $formData = (array) ($submission['form_data'] ?? []);
+        $uploads = (array) ($submission['uploads'] ?? []);
+        $submittedAt = $this->formatDateTime((string) ($submission['submitted_at'] ?? ''));
+
+        $steps = $this->formatter->getFormattedSteps($formData);
+        $uploadSummary = $this->formatter->getUploadSummary($uploads);
+
+        $app = Bootstrap::config('app');
+        $contactEmail = (string) ($app['contact_email'] ?? '');
+
+        $lines = [];
+        $lines[] = 'BESTÄTIGUNG IHRES MITGLIEDSANTRAGS';
+        $lines[] = str_repeat('=', 40);
         $lines[] = '';
-        $lines[] = 'Uploads:';
-        foreach ((array) ($submission['uploads'] ?? []) as $field => $files) {
-            if (!is_array($files)) {
-                continue;
+        $lines[] = 'Vielen Dank für Ihren Mitgliedsantrag bei der Freiwilligen Feuerwehr Freising.';
+        $lines[] = 'Ihre Daten wurden am ' . $submittedAt . ' erfolgreich übermittelt.';
+        $lines[] = '';
+        $lines[] = 'Zusammenfassung Ihrer Angaben:';
+
+        foreach ($steps as $step) {
+            $lines[] = '';
+            $lines[] = strtoupper($step['title']);
+            $lines[] = str_repeat('-', 40);
+            foreach ($step['fields'] as $field) {
+                $lines[] = $field['label'] . ': ' . $field['value'];
+            }
+        }
+
+        if ($uploadSummary !== []) {
+            $lines[] = '';
+            $lines[] = 'IHRE HOCHGELADENEN DATEIEN';
+            $lines[] = str_repeat('-', 40);
+            foreach ($uploadSummary as $upload) {
+                $lines[] = '- ' . $upload['label'] . ': ' . $upload['filename'];
             }
-            foreach ($files as $file) {
-                if (!is_array($file)) {
+        }
+
+        if ($contactEmail !== '') {
+            $lines[] = '';
+            $lines[] = 'Bei Rückfragen wenden Sie sich bitte an ' . $contactEmail . '.';
+        }
+
+        return implode("\n", $lines);
+    }
+
+    // ─── Shared HTML helpers ───────────────────────────────────────
+
+    /**
+     * @param array{title: string, fields: array<int, array{label: string, value: string, type: string}>} $step
+     * @param array<string, mixed> $formData
+     */
+    private function renderStepHtml(array $step, array $formData): string
+    {
+        $html = '<div style="margin-top:16px;">';
+        $html .= '<h2 style="margin:0;padding:8px 12px;background:#b40000;color:#fff;font-size:15px;border-radius:4px;">'
+            . $this->esc($step['title']) . '</h2>';
+        $html .= '<table style="width:100%;border-collapse:collapse;margin-top:4px;" cellpadding="0" cellspacing="0">';
+
+        $allFields = $this->schema->getAllFields();
+        $rowIndex = 0;
+        foreach ($step['fields'] as $field) {
+            $bgColor = $rowIndex % 2 === 0 ? '#ffffff' : '#f7f7f7';
+            $rowIndex++;
+
+            if ($field['type'] === 'table') {
+                $fieldKey = $this->findFieldKeyByLabel($field['label']);
+                $fieldDef = $fieldKey !== null ? ($allFields[$fieldKey] ?? []) : [];
+                $rawValue = $fieldKey !== null ? ($formData[$fieldKey] ?? '') : '';
+                $tableHtml = $this->formatter->formatTableHtml($rawValue, $fieldDef);
+                if ($tableHtml !== '') {
+                    $html .= '<tr style="background:' . $bgColor . ';">';
+                    $html .= '<td colspan="2" style="padding:8px 12px;border-bottom:1px solid #eee;">';
+                    $html .= '<strong style="font-size:13px;">' . $this->esc($field['label']) . '</strong><br>';
+                    $html .= $tableHtml;
+                    $html .= '</td></tr>';
                     continue;
                 }
-                $lines[] = sprintf(
-                    '- %s: %s (%s)',
-                    (string) $field,
-                    (string) ($file['original_filename'] ?? 'Datei'),
-                    (string) ($file['stored_dir'] ?? '')
-                );
             }
+
+            $html .= '<tr style="background:' . $bgColor . ';">';
+            $html .= '<td style="padding:8px 12px;width:45%;border-bottom:1px solid #eee;font-weight:bold;font-size:13px;vertical-align:top;">'
+                . $this->esc($field['label']) . '</td>';
+            $html .= '<td style="padding:8px 12px;border-bottom:1px solid #eee;font-size:13px;vertical-align:top;">'
+                . nl2br($this->esc($field['value'])) . '</td>';
+            $html .= '</tr>';
         }
 
-        return implode("\n", $lines);
+        $html .= '</table>';
+        $html .= '</div>';
+
+        return $html;
     }
 
-    /** @param array<string, mixed> $submission */
-    private function renderUserBody(array $submission): string
+    private function findFieldKeyByLabel(string $label): ?string
     {
-        return implode("\n", [
-            'Vielen Dank für Ihren Mitgliedsantrag beim Feuerwehrverein.',
-            'Ihre Daten wurden erfolgreich übermittelt.',
-            '',
-            'E-Mail: ' . (string) ($submission['email'] ?? ''),
-            'Eingangszeit: ' . (string) ($submission['submitted_at'] ?? ''),
-            '',
-            'Bei Rückfragen kontaktieren Sie bitte den Verein.',
-        ]);
+        foreach ($this->schema->getAllFields() as $key => $field) {
+            if ((string) ($field['label'] ?? '') === $label) {
+                return $key;
+            }
+        }
+        return null;
     }
 
-    private function defaultHeaders(): string
+    private function htmlHead(): string
     {
-        $from = (string) ($this->mailConfig['from'] ?? 'no-reply@example.org');
+        return '<!DOCTYPE html><html lang="de"><head><meta charset="UTF-8">'
+            . '<meta name="viewport" content="width=device-width,initial-scale=1.0">'
+            . '</head><body style="margin:0;padding:20px;background:#eee;">';
+    }
+
+    private function htmlFoot(): string
+    {
+        return '</body></html>';
+    }
+
+    // ─── Utility ───────────────────────────────────────────────────
 
-        return implode("\r\n", [
-            'MIME-Version: 1.0',
-            'Content-Type: text/plain; charset=UTF-8',
-            'From: ' . $from,
-        ]);
+    private function applicantName(array $submission): string
+    {
+        $formData = (array) ($submission['form_data'] ?? []);
+        return trim(($formData['vorname'] ?? '') . ' ' . ($formData['nachname'] ?? ''));
+    }
+
+    private function formatDateTime(string $isoDate): string
+    {
+        if ($isoDate === '') {
+            return '---';
+        }
+
+        $dt = \DateTimeImmutable::createFromFormat(\DateTimeInterface::ATOM, $isoDate);
+        if (!$dt) {
+            $dt = \DateTimeImmutable::createFromFormat('Y-m-d\TH:i:sP', $isoDate);
+        }
+        if (!$dt) {
+            return $isoDate;
+        }
+
+        return $dt->format('d.m.Y, H:i') . ' Uhr';
+    }
+
+    private function safeFilenameSegment(string $name): string
+    {
+        $safe = preg_replace('/[^A-Za-z0-9_\-]/', '_', $name) ?? 'Antrag';
+        return $safe !== '' ? $safe : 'Antrag';
+    }
+
+    private function esc(string $value): string
+    {
+        return htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
     }
 }

+ 436 - 0
src/Mail/PdfGenerator.php

@@ -0,0 +1,436 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Mail;
+
+use App\App\Bootstrap;
+use App\Form\FormSchema;
+use setasign\Fpdi\Tcpdf\Fpdi;
+use TCPDF;
+
+final class PdfGenerator
+{
+    private SubmissionFormatter $formatter;
+    private FormSchema $schema;
+    private string $uploadBasePath;
+
+    public function __construct(SubmissionFormatter $formatter, FormSchema $schema)
+    {
+        $this->formatter = $formatter;
+        $this->schema = $schema;
+
+        $app = Bootstrap::config('app');
+        $this->uploadBasePath = rtrim((string) ($app['storage']['uploads'] ?? ''), '/');
+    }
+
+    /**
+     * Generate PDF with form data and portrait photo.
+     *
+     * @param array<string, mixed> $submission
+     * @return string|null Path to temp PDF file, or null on failure.
+     */
+    public function generateFormDataPdf(array $submission): ?string
+    {
+        try {
+            $pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8');
+            $this->configurePdf($pdf, 'Mitgliedsantrag');
+            $pdf->AddPage();
+
+            $formData = (array) ($submission['form_data'] ?? []);
+            $uploads = (array) ($submission['uploads'] ?? []);
+            $email = (string) ($submission['email'] ?? '');
+            $submittedAt = $this->formatDateTime((string) ($submission['submitted_at'] ?? ''));
+            $name = trim(($formData['vorname'] ?? '') . ' ' . ($formData['nachname'] ?? ''));
+
+            $this->renderFormDataHeader($pdf, $name, $email, $submittedAt);
+            $this->renderPortrait($pdf, $uploads);
+            $this->renderFormDataSections($pdf, $formData);
+
+            $tmpPath = $this->tempPath('antragsdaten');
+            $pdf->Output($tmpPath, 'F');
+            return $tmpPath;
+        } catch (\Throwable $e) {
+            Bootstrap::log('mail', 'PDF-Erstellung (Antragsdaten) fehlgeschlagen: ' . $e->getMessage());
+            return null;
+        }
+    }
+
+    /**
+     * Generate PDF combining all attachments except the portrait photo.
+     *
+     * @param array<string, mixed> $submission
+     * @return string|null Path to temp PDF file, or null if no attachments or on failure.
+     */
+    public function generateAttachmentsPdf(array $submission): ?string
+    {
+        $uploads = (array) ($submission['uploads'] ?? []);
+        $formData = (array) ($submission['form_data'] ?? []);
+        $allFields = $this->schema->getAllFields();
+
+        $attachments = [];
+        foreach ($uploads as $fieldKey => $files) {
+            if ($fieldKey === 'portraitfoto' || !is_array($files)) {
+                continue;
+            }
+            $label = (string) ($allFields[$fieldKey]['label'] ?? $fieldKey);
+            foreach ($files as $file) {
+                if (!is_array($file)) {
+                    continue;
+                }
+                $relativePath = (string) ($file['relative_path'] ?? '');
+                $absolutePath = $this->uploadBasePath . '/' . $relativePath;
+                if ($relativePath !== '' && is_file($absolutePath)) {
+                    $attachments[] = [
+                        'path' => $absolutePath,
+                        'filename' => (string) ($file['original_filename'] ?? 'Datei'),
+                        'mime' => (string) ($file['mime'] ?? ''),
+                        'label' => $label,
+                    ];
+                }
+            }
+        }
+
+        if ($attachments === []) {
+            return null;
+        }
+
+        try {
+            $pdf = new Fpdi('P', 'mm', 'A4', true, 'UTF-8');
+            $this->configurePdf($pdf, 'Anlagen zum Mitgliedsantrag');
+
+            $name = trim(($formData['vorname'] ?? '') . ' ' . ($formData['nachname'] ?? ''));
+            $this->renderAttachmentsTitlePage($pdf, $name, $attachments);
+
+            foreach ($attachments as $att) {
+                $this->addAttachmentToPdf($pdf, $att);
+            }
+
+            $tmpPath = $this->tempPath('anlagen');
+            $pdf->Output($tmpPath, 'F');
+            return $tmpPath;
+        } catch (\Throwable $e) {
+            Bootstrap::log('mail', 'PDF-Erstellung (Anlagen) fehlgeschlagen: ' . $e->getMessage());
+            return null;
+        }
+    }
+
+    private function configurePdf(TCPDF $pdf, string $title): void
+    {
+        $pdf->setPrintHeader(false);
+        $pdf->setPrintFooter(true);
+        $pdf->SetCreator('Feuerwehr Freising - Mitgliedsantrag');
+        $pdf->SetAuthor('Feuerwehr Freising');
+        $pdf->SetTitle($title);
+        $pdf->SetAutoPageBreak(true, 20);
+        $pdf->SetMargins(15, 15, 15);
+        $pdf->SetFont('helvetica', '', 10);
+
+        $pdf->setFooterData(['0', '0', '0'], ['200', '200', '200']);
+        $pdf->setFooterFont(['helvetica', '', 8]);
+        $pdf->setFooterMargin(10);
+    }
+
+    private function renderFormDataHeader(TCPDF $pdf, string $name, string $email, string $submittedAt): void
+    {
+        $pdf->SetFont('helvetica', 'B', 16);
+        $pdf->Cell(0, 10, 'Mitgliedsantrag', 0, 1, 'L');
+        $pdf->SetFont('helvetica', '', 11);
+        $pdf->Cell(0, 6, 'Freiwillige Feuerwehr Freising e.V.', 0, 1, 'L');
+        $pdf->Ln(4);
+
+        $pdf->SetFont('helvetica', '', 10);
+        $pdf->SetFillColor(245, 245, 245);
+
+        $metaHtml = '<table cellpadding="4" style="font-size:10px;">';
+        $metaHtml .= '<tr><td style="width:140px;font-weight:bold;">Name:</td><td>' . $this->esc($name) . '</td></tr>';
+        $metaHtml .= '<tr><td style="font-weight:bold;">E-Mail:</td><td>' . $this->esc($email) . '</td></tr>';
+        $metaHtml .= '<tr><td style="font-weight:bold;">Eingereicht am:</td><td>' . $this->esc($submittedAt) . '</td></tr>';
+        $metaHtml .= '</table>';
+
+        $pdf->writeHTML($metaHtml, true, false, true, false, '');
+        $pdf->Ln(2);
+        $pdf->SetDrawColor(180, 0, 0);
+        $pdf->Line(15, $pdf->GetY(), 195, $pdf->GetY());
+        $pdf->SetDrawColor(0, 0, 0);
+        $pdf->Ln(4);
+    }
+
+    /**
+     * @param array<string, mixed> $uploads
+     */
+    private function renderPortrait(TCPDF $pdf, array $uploads): void
+    {
+        $portraitFiles = $uploads['portraitfoto'] ?? [];
+        if (!is_array($portraitFiles) || empty($portraitFiles)) {
+            return;
+        }
+
+        $file = $portraitFiles[0];
+        if (!is_array($file)) {
+            return;
+        }
+
+        $relativePath = (string) ($file['relative_path'] ?? '');
+        $absolutePath = $this->uploadBasePath . '/' . $relativePath;
+
+        if ($relativePath === '' || !is_file($absolutePath)) {
+            return;
+        }
+
+        $mime = (string) ($file['mime'] ?? '');
+        $imagePath = $this->resolveImageForPdf($absolutePath, $mime);
+
+        if ($imagePath === null) {
+            $pdf->SetFont('helvetica', 'I', 9);
+            $pdf->Cell(0, 6, 'Portraitfoto: ' . ($file['original_filename'] ?? 'Datei') . ' (WebP-Format, siehe digitale Unterlagen)', 0, 1);
+            $pdf->SetFont('helvetica', '', 10);
+            return;
+        }
+
+        $startY = $pdf->GetY();
+        $pdf->Image($imagePath, 150, $startY, 35, 0, '', '', '', true, 150, '', false, false, 0, 'CT');
+
+        if ($imagePath !== $absolutePath && is_file($imagePath)) {
+            @unlink($imagePath);
+        }
+    }
+
+    /**
+     * @param array<string, mixed> $formData
+     */
+    private function renderFormDataSections(TCPDF $pdf, array $formData): void
+    {
+        $steps = $this->formatter->getFormattedSteps($formData);
+
+        foreach ($steps as $step) {
+            if ($pdf->GetY() > 250) {
+                $pdf->AddPage();
+            }
+
+            $pdf->SetFont('helvetica', 'B', 12);
+            $pdf->SetFillColor(180, 0, 0);
+            $pdf->SetTextColor(255, 255, 255);
+            $pdf->Cell(0, 8, ' ' . $step['title'], 0, 1, 'L', true);
+            $pdf->SetTextColor(0, 0, 0);
+            $pdf->Ln(2);
+
+            $pdf->SetFont('helvetica', '', 10);
+
+            foreach ($step['fields'] as $field) {
+                if ($pdf->GetY() > 265) {
+                    $pdf->AddPage();
+                }
+
+                if ($field['type'] === 'table') {
+                    $pdf->SetFont('helvetica', 'B', 10);
+                    $pdf->Cell(0, 6, $field['label'], 0, 1, 'L');
+                    $pdf->SetFont('helvetica', '', 9);
+                    $pdf->MultiCell(0, 5, $field['value'], 0, 'L');
+                    $pdf->Ln(1);
+                    continue;
+                }
+
+                $labelWidth = 80;
+                $pdf->SetFont('helvetica', 'B', 9);
+                $startX = $pdf->GetX();
+                $startY = $pdf->GetY();
+                $pdf->MultiCell($labelWidth, 5, $field['label'] . ':', 0, 'L', false, 0);
+                $pdf->SetFont('helvetica', '', 9);
+                $pdf->SetXY($startX + $labelWidth, $startY);
+                $pdf->MultiCell(0, 5, $field['value'], 0, 'L');
+                $pdf->Ln(1);
+            }
+
+            $pdf->Ln(3);
+        }
+    }
+
+    /**
+     * @param array<int, array{path: string, filename: string, mime: string, label: string}> $attachments
+     */
+    private function renderAttachmentsTitlePage(Fpdi $pdf, string $name, array $attachments): void
+    {
+        $pdf->AddPage();
+
+        $pdf->SetFont('helvetica', 'B', 16);
+        $pdf->Cell(0, 10, 'Anlagen zum Mitgliedsantrag', 0, 1, 'L');
+        $pdf->SetFont('helvetica', '', 11);
+        $pdf->Cell(0, 6, 'Freiwillige Feuerwehr Freising e.V.', 0, 1, 'L');
+
+        if ($name !== '') {
+            $pdf->Ln(2);
+            $pdf->SetFont('helvetica', '', 10);
+            $pdf->Cell(0, 6, 'Antragsteller: ' . $name, 0, 1, 'L');
+        }
+
+        $pdf->Ln(6);
+        $pdf->SetDrawColor(180, 0, 0);
+        $pdf->Line(15, $pdf->GetY(), 195, $pdf->GetY());
+        $pdf->SetDrawColor(0, 0, 0);
+        $pdf->Ln(6);
+
+        $pdf->SetFont('helvetica', 'B', 11);
+        $pdf->Cell(0, 6, 'Enthaltene Dokumente:', 0, 1, 'L');
+        $pdf->Ln(2);
+
+        $pdf->SetFont('helvetica', '', 10);
+        $index = 1;
+        foreach ($attachments as $att) {
+            $pdf->Cell(10, 6, (string) $index . '.', 0, 0, 'R');
+            $pdf->Cell(0, 6, $att['label'] . ': ' . $att['filename'], 0, 1, 'L');
+            $index++;
+        }
+    }
+
+    /**
+     * @param array{path: string, filename: string, mime: string, label: string} $att
+     */
+    private function addAttachmentToPdf(Fpdi $pdf, array $att): void
+    {
+        $mime = $att['mime'];
+        $path = $att['path'];
+
+        if ($mime === 'application/pdf') {
+            $this->importPdfPages($pdf, $path, $att['filename'], $att['label']);
+        } elseif (str_starts_with($mime, 'image/')) {
+            $this->addImagePage($pdf, $path, $mime, $att['filename'], $att['label']);
+        }
+    }
+
+    private function importPdfPages(Fpdi $pdf, string $pdfPath, string $filename, string $label): void
+    {
+        try {
+            $pageCount = $pdf->setSourceFile($pdfPath);
+            for ($i = 1; $i <= $pageCount; $i++) {
+                $tplId = $pdf->importPage($i);
+                $size = $pdf->getTemplateSize($tplId);
+                $orientation = ($size['width'] > $size['height']) ? 'L' : 'P';
+                $pdf->AddPage($orientation);
+
+                if ($i === 1) {
+                    $this->renderAttachmentLabel($pdf, $label, $filename);
+                }
+
+                $availableHeight = $pdf->getPageHeight() - $pdf->GetY() - 20;
+                $availableWidth = $pdf->getPageWidth() - 30;
+
+                $scale = min(
+                    $availableWidth / $size['width'],
+                    $availableHeight / $size['height'],
+                    1.0
+                );
+
+                $renderWidth = $size['width'] * $scale;
+                $pdf->useTemplate($tplId, 15, $pdf->GetY(), $renderWidth);
+            }
+        } catch (\Throwable $e) {
+            $pdf->AddPage();
+            $this->renderAttachmentLabel($pdf, $label, $filename);
+            $pdf->SetFont('helvetica', 'I', 10);
+            $pdf->Cell(0, 8, 'PDF konnte nicht eingebettet werden.', 0, 1, 'L');
+            Bootstrap::log('mail', 'PDF-Import fehlgeschlagen für ' . $pdfPath . ': ' . $e->getMessage());
+        }
+    }
+
+    private function addImagePage(Fpdi|TCPDF $pdf, string $imagePath, string $mime, string $filename, string $label): void
+    {
+        $resolvedPath = $this->resolveImageForPdf($imagePath, $mime);
+
+        $pdf->AddPage();
+        $this->renderAttachmentLabel($pdf, $label, $filename);
+
+        if ($resolvedPath === null) {
+            $pdf->SetFont('helvetica', 'I', 10);
+            $pdf->Cell(0, 8, 'Bild im WebP-Format — siehe digitale Unterlagen (' . $filename . ')', 0, 1, 'L');
+            return;
+        }
+
+        $startY = $pdf->GetY();
+        $availableHeight = $pdf->getPageHeight() - $startY - 20;
+        $availableWidth = $pdf->getPageWidth() - 30;
+
+        $pdf->Image(
+            $resolvedPath,
+            15,
+            $startY,
+            $availableWidth,
+            $availableHeight,
+            '',
+            '',
+            '',
+            true,
+            150,
+            '',
+            false,
+            false,
+            0,
+            'CT'
+        );
+
+        if ($resolvedPath !== $imagePath && is_file($resolvedPath)) {
+            @unlink($resolvedPath);
+        }
+    }
+
+    private function renderAttachmentLabel(TCPDF $pdf, string $label, string $filename): void
+    {
+        $pdf->SetFont('helvetica', 'B', 9);
+        $pdf->SetFillColor(245, 245, 245);
+        $pdf->Cell(0, 6, ' ' . $label . ': ' . $filename, 0, 1, 'L', true);
+        $pdf->Ln(2);
+    }
+
+    /**
+     * Resolve an image path for TCPDF. TCPDF handles JPEG and PNG natively.
+     * WebP needs GD conversion. Returns null if conversion is not possible.
+     */
+    private function resolveImageForPdf(string $absolutePath, string $mime): ?string
+    {
+        if ($mime !== 'image/webp') {
+            return $absolutePath;
+        }
+
+        if (!function_exists('imagecreatefromwebp') || !function_exists('imagejpeg')) {
+            return null;
+        }
+
+        $image = @imagecreatefromwebp($absolutePath);
+        if ($image === false) {
+            return null;
+        }
+
+        $tmpPath = sys_get_temp_dir() . '/antrag_webp_' . bin2hex(random_bytes(8)) . '.jpg';
+        $ok = @imagejpeg($image, $tmpPath, 90);
+        imagedestroy($image);
+
+        return $ok ? $tmpPath : null;
+    }
+
+    private function formatDateTime(string $isoDate): string
+    {
+        if ($isoDate === '') {
+            return '---';
+        }
+
+        $dt = \DateTimeImmutable::createFromFormat(\DateTimeInterface::ATOM, $isoDate);
+        if (!$dt) {
+            $dt = \DateTimeImmutable::createFromFormat('Y-m-d\TH:i:sP', $isoDate);
+        }
+        if (!$dt) {
+            return $isoDate;
+        }
+
+        return $dt->format('d.m.Y, H:i') . ' Uhr';
+    }
+
+    private function tempPath(string $prefix): string
+    {
+        return sys_get_temp_dir() . '/antrag_' . $prefix . '_' . bin2hex(random_bytes(8)) . '.pdf';
+    }
+
+    private function esc(string $value): string
+    {
+        return htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
+    }
+}

+ 423 - 0
src/Mail/SubmissionFormatter.php

@@ -0,0 +1,423 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Mail;
+
+use App\Form\FormSchema;
+
+final class SubmissionFormatter
+{
+    private FormSchema $schema;
+
+    public function __construct(FormSchema $schema)
+    {
+        $this->schema = $schema;
+    }
+
+    /**
+     * @param array<string, mixed> $formData
+     * @return array<int, array{title: string, fields: array<int, array{label: string, value: string, type: string}>}>
+     */
+    public function getFormattedSteps(array $formData): array
+    {
+        $result = [];
+
+        foreach ($this->schema->getSteps() as $step) {
+            $title = (string) ($step['title'] ?? '');
+            $fields = $step['fields'] ?? [];
+            if (!is_array($fields)) {
+                continue;
+            }
+
+            $formattedFields = [];
+            foreach ($fields as $field) {
+                if (!is_array($field) || !isset($field['key'])) {
+                    continue;
+                }
+
+                $type = (string) ($field['type'] ?? 'text');
+                if ($type === 'file') {
+                    continue;
+                }
+
+                if (!$this->isVisible($field, $formData)) {
+                    continue;
+                }
+
+                $key = (string) $field['key'];
+                $label = (string) ($field['label'] ?? $key);
+                $rawValue = $formData[$key] ?? '';
+
+                $formatted = $this->formatValue($rawValue, $field, $formData);
+                if ($formatted === '' && !$this->isRequired($field, $formData)) {
+                    continue;
+                }
+
+                $formattedFields[] = [
+                    'label' => $label,
+                    'value' => $formatted !== '' ? $formatted : '---',
+                    'type' => $type,
+                ];
+            }
+
+            if ($formattedFields !== []) {
+                $result[] = [
+                    'title' => $title,
+                    'fields' => $formattedFields,
+                ];
+            }
+        }
+
+        return $result;
+    }
+
+    /**
+     * @param array<string, mixed> $uploads
+     * @return array<int, array{label: string, filename: string}>
+     */
+    public function getUploadSummary(array $uploads): array
+    {
+        $allFields = $this->schema->getAllFields();
+        $summary = [];
+
+        foreach ($uploads as $fieldKey => $files) {
+            if (!is_array($files)) {
+                continue;
+            }
+            $label = (string) ($allFields[$fieldKey]['label'] ?? $fieldKey);
+            foreach ($files as $file) {
+                if (!is_array($file)) {
+                    continue;
+                }
+                $summary[] = [
+                    'label' => $label,
+                    'filename' => (string) ($file['original_filename'] ?? 'Datei'),
+                ];
+            }
+        }
+
+        return $summary;
+    }
+
+    /**
+     * @param array<string, mixed> $field
+     * @param array<string, mixed> $formData
+     */
+    private function formatValue(mixed $rawValue, array $field, array $formData): string
+    {
+        $type = (string) ($field['type'] ?? 'text');
+        $stringValue = is_scalar($rawValue) ? trim((string) $rawValue) : '';
+
+        switch ($type) {
+            case 'date':
+                return $this->formatDate($stringValue);
+
+            case 'checkbox':
+                return in_array($stringValue, ['1', 'on', 'true'], true) ? 'Ja' : 'Nein';
+
+            case 'select':
+                return $this->resolveSelectLabel($stringValue, $field, $formData);
+
+            case 'table':
+                return $this->formatTable($rawValue, $field);
+
+            default:
+                return $stringValue;
+        }
+    }
+
+    private function formatDate(string $value): string
+    {
+        if ($value === '') {
+            return '';
+        }
+
+        $date = \DateTimeImmutable::createFromFormat('!Y-m-d', $value);
+        if (!$date || $date->format('Y-m-d') !== $value) {
+            return $value;
+        }
+
+        return $date->format('d.m.Y');
+    }
+
+    /**
+     * @param array<string, mixed> $field
+     * @param array<string, mixed> $formData
+     */
+    private function resolveSelectLabel(string $value, array $field, array $formData): string
+    {
+        if ($value === '' || !isset($field['options']) || !is_array($field['options'])) {
+            return $value;
+        }
+
+        foreach ($field['options'] as $option) {
+            if (!is_array($option)) {
+                continue;
+            }
+            if ((string) ($option['value'] ?? '') === $value) {
+                return (string) ($option['label'] ?? $value);
+            }
+        }
+
+        return $value;
+    }
+
+    /**
+     * @param array<string, mixed> $field
+     */
+    private function formatTable(mixed $rawValue, array $field): string
+    {
+        $raw = is_scalar($rawValue) ? trim((string) $rawValue) : '';
+        if ($raw === '') {
+            return '';
+        }
+
+        $lines = preg_split('/\R/', $raw);
+        if (!is_array($lines)) {
+            return $raw;
+        }
+
+        $rows = [];
+        foreach ($lines as $line) {
+            $line = trim((string) $line);
+            if ($line === '') {
+                continue;
+            }
+            $rows[] = str_getcsv($line);
+        }
+
+        if (empty($rows)) {
+            return '';
+        }
+
+        $columnHeaders = $this->getTableColumnHeaders($field);
+
+        $dataRows = $rows;
+        if ($columnHeaders !== [] && $this->tableRowMatchesHeader($rows[0], $columnHeaders)) {
+            $dataRows = array_slice($rows, 1);
+        }
+
+        $nonEmptyRows = [];
+        foreach ($dataRows as $row) {
+            $hasContent = false;
+            foreach ((array) $row as $cell) {
+                if (trim((string) $cell) !== '') {
+                    $hasContent = true;
+                    break;
+                }
+            }
+            if ($hasContent) {
+                $nonEmptyRows[] = $row;
+            }
+        }
+
+        if (empty($nonEmptyRows)) {
+            return '';
+        }
+
+        $output = [];
+        foreach ($nonEmptyRows as $row) {
+            $parts = [];
+            foreach ((array) $row as $i => $cell) {
+                $cell = trim((string) $cell);
+                $header = $columnHeaders[$i] ?? '';
+                if ($cell !== '') {
+                    $cellValue = $this->formatDate($cell);
+                    if ($cellValue === $cell) {
+                        $cellValue = $cell;
+                    }
+                    $parts[] = $header !== '' ? ($header . ': ' . $cellValue) : $cellValue;
+                }
+            }
+            if ($parts !== []) {
+                $output[] = implode(', ', $parts);
+            }
+        }
+
+        return implode("\n", $output);
+    }
+
+    /**
+     * Format table data as HTML table.
+     *
+     * @param array<string, mixed> $field
+     */
+    public function formatTableHtml(mixed $rawValue, array $field): string
+    {
+        $raw = is_scalar($rawValue) ? trim((string) $rawValue) : '';
+        if ($raw === '') {
+            return '';
+        }
+
+        $lines = preg_split('/\R/', $raw);
+        if (!is_array($lines)) {
+            return htmlspecialchars($raw, ENT_QUOTES, 'UTF-8');
+        }
+
+        $rows = [];
+        foreach ($lines as $line) {
+            $line = trim((string) $line);
+            if ($line === '') {
+                continue;
+            }
+            $rows[] = str_getcsv($line);
+        }
+
+        if (empty($rows)) {
+            return '';
+        }
+
+        $columnHeaders = $this->getTableColumnHeaders($field);
+
+        $dataRows = $rows;
+        if ($columnHeaders !== [] && $this->tableRowMatchesHeader($rows[0], $columnHeaders)) {
+            $dataRows = array_slice($rows, 1);
+        }
+
+        $nonEmptyRows = [];
+        foreach ($dataRows as $row) {
+            $hasContent = false;
+            foreach ((array) $row as $cell) {
+                if (trim((string) $cell) !== '') {
+                    $hasContent = true;
+                    break;
+                }
+            }
+            if ($hasContent) {
+                $nonEmptyRows[] = $row;
+            }
+        }
+
+        if (empty($nonEmptyRows)) {
+            return '';
+        }
+
+        $html = '<table style="border-collapse:collapse;width:100%;margin:4px 0;" cellpadding="4" cellspacing="0">';
+        if ($columnHeaders !== []) {
+            $html .= '<tr>';
+            foreach ($columnHeaders as $header) {
+                $html .= '<th style="border:1px solid #ccc;background:#f0f0f0;text-align:left;padding:4px 8px;font-size:13px;">'
+                    . htmlspecialchars($header, ENT_QUOTES, 'UTF-8') . '</th>';
+            }
+            $html .= '</tr>';
+        }
+        foreach ($nonEmptyRows as $row) {
+            $html .= '<tr>';
+            foreach ((array) $row as $i => $cell) {
+                $cell = trim((string) $cell);
+                $cell = $this->formatDate($cell) ?: $cell;
+                $html .= '<td style="border:1px solid #ccc;padding:4px 8px;font-size:13px;">'
+                    . htmlspecialchars($cell, ENT_QUOTES, 'UTF-8') . '</td>';
+            }
+            $html .= '</tr>';
+        }
+        $html .= '</table>';
+
+        return $html;
+    }
+
+    /**
+     * @param array<string, mixed> $field
+     * @return array<int, string>
+     */
+    private function getTableColumnHeaders(array $field): array
+    {
+        $headers = [];
+        if (isset($field['columns']) && is_array($field['columns'])) {
+            foreach ($field['columns'] as $column) {
+                if (!is_array($column)) {
+                    continue;
+                }
+                $label = trim((string) ($column['label'] ?? ''));
+                if ($label !== '') {
+                    $headers[] = $label;
+                }
+            }
+        }
+        return $headers;
+    }
+
+    /**
+     * @param array<int, string> $row
+     * @param array<int, string> $header
+     */
+    private function tableRowMatchesHeader(array $row, array $header): bool
+    {
+        if (count($row) !== count($header)) {
+            return false;
+        }
+        foreach ($header as $index => $headerValue) {
+            if (strtolower(trim((string) ($row[$index] ?? ''))) !== strtolower(trim($headerValue))) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /** @param array<string, mixed> $field */
+    private function isVisible(array $field, array $formData): bool
+    {
+        if (!isset($field['visible_if']) || !is_array($field['visible_if'])) {
+            return true;
+        }
+        return $this->ruleMatches($field['visible_if'], $formData);
+    }
+
+    /** @param array<string, mixed> $field */
+    private function isRequired(array $field, array $formData): bool
+    {
+        if (($field['required'] ?? false) === true) {
+            return true;
+        }
+        if (isset($field['required_if']) && is_array($field['required_if'])) {
+            return $this->ruleMatches($field['required_if'], $formData);
+        }
+        return false;
+    }
+
+    /** @param array<string, mixed> $rule */
+    private function ruleMatches(array $rule, array $formData): bool
+    {
+        $sourceField = (string) ($rule['field'] ?? '');
+        $equals = (string) ($rule['equals'] ?? '');
+        if ($sourceField === '') {
+            return false;
+        }
+        return $this->resolveRuleValue($sourceField, $formData) === $equals;
+    }
+
+    private function resolveRuleValue(string $sourceField, array $formData): string
+    {
+        if (array_key_exists($sourceField, $formData)) {
+            return (string) ($formData[$sourceField] ?? '');
+        }
+        $derived = $this->derivedValues($formData);
+        return (string) ($derived[$sourceField] ?? '');
+    }
+
+    /**
+     * @param array<string, mixed> $formData
+     * @return array<string, string>
+     */
+    private function derivedValues(array $formData): array
+    {
+        $birthdate = trim((string) ($formData['geburtsdatum'] ?? ''));
+        if ($birthdate === '') {
+            return ['is_minor' => ''];
+        }
+
+        $date = \DateTimeImmutable::createFromFormat('!Y-m-d', $birthdate);
+        if (!$date || $date->format('Y-m-d') !== $birthdate) {
+            return ['is_minor' => ''];
+        }
+
+        $today = new \DateTimeImmutable('today');
+        if ($date > $today) {
+            return ['is_minor' => ''];
+        }
+
+        $age = $date->diff($today)->y;
+        return ['is_minor' => $age >= 18 ? '0' : '1'];
+    }
+}

+ 5 - 0
src/autoload.php

@@ -2,6 +2,11 @@
 
 declare(strict_types=1);
 
+$composerAutoload = dirname(__DIR__) . '/vendor/autoload.php';
+if (is_file($composerAutoload)) {
+    require_once $composerAutoload;
+}
+
 spl_autoload_register(static function (string $class): void {
     $prefix = 'App\\';
     $baseDir = __DIR__ . '/';

+ 22 - 0
vendor/autoload.php

@@ -0,0 +1,22 @@
+<?php
+
+// autoload.php @generated by Composer
+
+if (PHP_VERSION_ID < 50600) {
+    if (!headers_sent()) {
+        header('HTTP/1.1 500 Internal Server Error');
+    }
+    $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
+    if (!ini_get('display_errors')) {
+        if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
+            fwrite(STDERR, $err);
+        } elseif (!headers_sent()) {
+            echo $err;
+        }
+    }
+    throw new RuntimeException($err);
+}
+
+require_once __DIR__ . '/composer/autoload_real.php';
+
+return ComposerAutoloaderInitc4d2c538d2df0a0f21bbe8fb0b8f7609::getLoader();

+ 579 - 0
vendor/composer/ClassLoader.php

@@ -0,0 +1,579 @@
+<?php
+
+/*
+ * This file is part of Composer.
+ *
+ * (c) Nils Adermann <naderman@naderman.de>
+ *     Jordi Boggiano <j.boggiano@seld.be>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Composer\Autoload;
+
+/**
+ * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
+ *
+ *     $loader = new \Composer\Autoload\ClassLoader();
+ *
+ *     // register classes with namespaces
+ *     $loader->add('Symfony\Component', __DIR__.'/component');
+ *     $loader->add('Symfony',           __DIR__.'/framework');
+ *
+ *     // activate the autoloader
+ *     $loader->register();
+ *
+ *     // to enable searching the include path (eg. for PEAR packages)
+ *     $loader->setUseIncludePath(true);
+ *
+ * In this example, if you try to use a class in the Symfony\Component
+ * namespace or one of its children (Symfony\Component\Console for instance),
+ * the autoloader will first look for the class under the component/
+ * directory, and it will then fallback to the framework/ directory if not
+ * found before giving up.
+ *
+ * This class is loosely based on the Symfony UniversalClassLoader.
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ * @author Jordi Boggiano <j.boggiano@seld.be>
+ * @see    https://www.php-fig.org/psr/psr-0/
+ * @see    https://www.php-fig.org/psr/psr-4/
+ */
+class ClassLoader
+{
+    /** @var \Closure(string):void */
+    private static $includeFile;
+
+    /** @var string|null */
+    private $vendorDir;
+
+    // PSR-4
+    /**
+     * @var array<string, array<string, int>>
+     */
+    private $prefixLengthsPsr4 = array();
+    /**
+     * @var array<string, list<string>>
+     */
+    private $prefixDirsPsr4 = array();
+    /**
+     * @var list<string>
+     */
+    private $fallbackDirsPsr4 = array();
+
+    // PSR-0
+    /**
+     * List of PSR-0 prefixes
+     *
+     * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
+     *
+     * @var array<string, array<string, list<string>>>
+     */
+    private $prefixesPsr0 = array();
+    /**
+     * @var list<string>
+     */
+    private $fallbackDirsPsr0 = array();
+
+    /** @var bool */
+    private $useIncludePath = false;
+
+    /**
+     * @var array<string, string>
+     */
+    private $classMap = array();
+
+    /** @var bool */
+    private $classMapAuthoritative = false;
+
+    /**
+     * @var array<string, bool>
+     */
+    private $missingClasses = array();
+
+    /** @var string|null */
+    private $apcuPrefix;
+
+    /**
+     * @var array<string, self>
+     */
+    private static $registeredLoaders = array();
+
+    /**
+     * @param string|null $vendorDir
+     */
+    public function __construct($vendorDir = null)
+    {
+        $this->vendorDir = $vendorDir;
+        self::initializeIncludeClosure();
+    }
+
+    /**
+     * @return array<string, list<string>>
+     */
+    public function getPrefixes()
+    {
+        if (!empty($this->prefixesPsr0)) {
+            return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
+        }
+
+        return array();
+    }
+
+    /**
+     * @return array<string, list<string>>
+     */
+    public function getPrefixesPsr4()
+    {
+        return $this->prefixDirsPsr4;
+    }
+
+    /**
+     * @return list<string>
+     */
+    public function getFallbackDirs()
+    {
+        return $this->fallbackDirsPsr0;
+    }
+
+    /**
+     * @return list<string>
+     */
+    public function getFallbackDirsPsr4()
+    {
+        return $this->fallbackDirsPsr4;
+    }
+
+    /**
+     * @return array<string, string> Array of classname => path
+     */
+    public function getClassMap()
+    {
+        return $this->classMap;
+    }
+
+    /**
+     * @param array<string, string> $classMap Class to filename map
+     *
+     * @return void
+     */
+    public function addClassMap(array $classMap)
+    {
+        if ($this->classMap) {
+            $this->classMap = array_merge($this->classMap, $classMap);
+        } else {
+            $this->classMap = $classMap;
+        }
+    }
+
+    /**
+     * Registers a set of PSR-0 directories for a given prefix, either
+     * appending or prepending to the ones previously set for this prefix.
+     *
+     * @param string              $prefix  The prefix
+     * @param list<string>|string $paths   The PSR-0 root directories
+     * @param bool                $prepend Whether to prepend the directories
+     *
+     * @return void
+     */
+    public function add($prefix, $paths, $prepend = false)
+    {
+        $paths = (array) $paths;
+        if (!$prefix) {
+            if ($prepend) {
+                $this->fallbackDirsPsr0 = array_merge(
+                    $paths,
+                    $this->fallbackDirsPsr0
+                );
+            } else {
+                $this->fallbackDirsPsr0 = array_merge(
+                    $this->fallbackDirsPsr0,
+                    $paths
+                );
+            }
+
+            return;
+        }
+
+        $first = $prefix[0];
+        if (!isset($this->prefixesPsr0[$first][$prefix])) {
+            $this->prefixesPsr0[$first][$prefix] = $paths;
+
+            return;
+        }
+        if ($prepend) {
+            $this->prefixesPsr0[$first][$prefix] = array_merge(
+                $paths,
+                $this->prefixesPsr0[$first][$prefix]
+            );
+        } else {
+            $this->prefixesPsr0[$first][$prefix] = array_merge(
+                $this->prefixesPsr0[$first][$prefix],
+                $paths
+            );
+        }
+    }
+
+    /**
+     * Registers a set of PSR-4 directories for a given namespace, either
+     * appending or prepending to the ones previously set for this namespace.
+     *
+     * @param string              $prefix  The prefix/namespace, with trailing '\\'
+     * @param list<string>|string $paths   The PSR-4 base directories
+     * @param bool                $prepend Whether to prepend the directories
+     *
+     * @throws \InvalidArgumentException
+     *
+     * @return void
+     */
+    public function addPsr4($prefix, $paths, $prepend = false)
+    {
+        $paths = (array) $paths;
+        if (!$prefix) {
+            // Register directories for the root namespace.
+            if ($prepend) {
+                $this->fallbackDirsPsr4 = array_merge(
+                    $paths,
+                    $this->fallbackDirsPsr4
+                );
+            } else {
+                $this->fallbackDirsPsr4 = array_merge(
+                    $this->fallbackDirsPsr4,
+                    $paths
+                );
+            }
+        } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
+            // Register directories for a new namespace.
+            $length = strlen($prefix);
+            if ('\\' !== $prefix[$length - 1]) {
+                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
+            }
+            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
+            $this->prefixDirsPsr4[$prefix] = $paths;
+        } elseif ($prepend) {
+            // Prepend directories for an already registered namespace.
+            $this->prefixDirsPsr4[$prefix] = array_merge(
+                $paths,
+                $this->prefixDirsPsr4[$prefix]
+            );
+        } else {
+            // Append directories for an already registered namespace.
+            $this->prefixDirsPsr4[$prefix] = array_merge(
+                $this->prefixDirsPsr4[$prefix],
+                $paths
+            );
+        }
+    }
+
+    /**
+     * Registers a set of PSR-0 directories for a given prefix,
+     * replacing any others previously set for this prefix.
+     *
+     * @param string              $prefix The prefix
+     * @param list<string>|string $paths  The PSR-0 base directories
+     *
+     * @return void
+     */
+    public function set($prefix, $paths)
+    {
+        if (!$prefix) {
+            $this->fallbackDirsPsr0 = (array) $paths;
+        } else {
+            $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
+        }
+    }
+
+    /**
+     * Registers a set of PSR-4 directories for a given namespace,
+     * replacing any others previously set for this namespace.
+     *
+     * @param string              $prefix The prefix/namespace, with trailing '\\'
+     * @param list<string>|string $paths  The PSR-4 base directories
+     *
+     * @throws \InvalidArgumentException
+     *
+     * @return void
+     */
+    public function setPsr4($prefix, $paths)
+    {
+        if (!$prefix) {
+            $this->fallbackDirsPsr4 = (array) $paths;
+        } else {
+            $length = strlen($prefix);
+            if ('\\' !== $prefix[$length - 1]) {
+                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
+            }
+            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
+            $this->prefixDirsPsr4[$prefix] = (array) $paths;
+        }
+    }
+
+    /**
+     * Turns on searching the include path for class files.
+     *
+     * @param bool $useIncludePath
+     *
+     * @return void
+     */
+    public function setUseIncludePath($useIncludePath)
+    {
+        $this->useIncludePath = $useIncludePath;
+    }
+
+    /**
+     * Can be used to check if the autoloader uses the include path to check
+     * for classes.
+     *
+     * @return bool
+     */
+    public function getUseIncludePath()
+    {
+        return $this->useIncludePath;
+    }
+
+    /**
+     * Turns off searching the prefix and fallback directories for classes
+     * that have not been registered with the class map.
+     *
+     * @param bool $classMapAuthoritative
+     *
+     * @return void
+     */
+    public function setClassMapAuthoritative($classMapAuthoritative)
+    {
+        $this->classMapAuthoritative = $classMapAuthoritative;
+    }
+
+    /**
+     * Should class lookup fail if not found in the current class map?
+     *
+     * @return bool
+     */
+    public function isClassMapAuthoritative()
+    {
+        return $this->classMapAuthoritative;
+    }
+
+    /**
+     * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
+     *
+     * @param string|null $apcuPrefix
+     *
+     * @return void
+     */
+    public function setApcuPrefix($apcuPrefix)
+    {
+        $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
+    }
+
+    /**
+     * The APCu prefix in use, or null if APCu caching is not enabled.
+     *
+     * @return string|null
+     */
+    public function getApcuPrefix()
+    {
+        return $this->apcuPrefix;
+    }
+
+    /**
+     * Registers this instance as an autoloader.
+     *
+     * @param bool $prepend Whether to prepend the autoloader or not
+     *
+     * @return void
+     */
+    public function register($prepend = false)
+    {
+        spl_autoload_register(array($this, 'loadClass'), true, $prepend);
+
+        if (null === $this->vendorDir) {
+            return;
+        }
+
+        if ($prepend) {
+            self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
+        } else {
+            unset(self::$registeredLoaders[$this->vendorDir]);
+            self::$registeredLoaders[$this->vendorDir] = $this;
+        }
+    }
+
+    /**
+     * Unregisters this instance as an autoloader.
+     *
+     * @return void
+     */
+    public function unregister()
+    {
+        spl_autoload_unregister(array($this, 'loadClass'));
+
+        if (null !== $this->vendorDir) {
+            unset(self::$registeredLoaders[$this->vendorDir]);
+        }
+    }
+
+    /**
+     * Loads the given class or interface.
+     *
+     * @param  string    $class The name of the class
+     * @return true|null True if loaded, null otherwise
+     */
+    public function loadClass($class)
+    {
+        if ($file = $this->findFile($class)) {
+            $includeFile = self::$includeFile;
+            $includeFile($file);
+
+            return true;
+        }
+
+        return null;
+    }
+
+    /**
+     * Finds the path to the file where the class is defined.
+     *
+     * @param string $class The name of the class
+     *
+     * @return string|false The path if found, false otherwise
+     */
+    public function findFile($class)
+    {
+        // class map lookup
+        if (isset($this->classMap[$class])) {
+            return $this->classMap[$class];
+        }
+        if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
+            return false;
+        }
+        if (null !== $this->apcuPrefix) {
+            $file = apcu_fetch($this->apcuPrefix.$class, $hit);
+            if ($hit) {
+                return $file;
+            }
+        }
+
+        $file = $this->findFileWithExtension($class, '.php');
+
+        // Search for Hack files if we are running on HHVM
+        if (false === $file && defined('HHVM_VERSION')) {
+            $file = $this->findFileWithExtension($class, '.hh');
+        }
+
+        if (null !== $this->apcuPrefix) {
+            apcu_add($this->apcuPrefix.$class, $file);
+        }
+
+        if (false === $file) {
+            // Remember that this class does not exist.
+            $this->missingClasses[$class] = true;
+        }
+
+        return $file;
+    }
+
+    /**
+     * Returns the currently registered loaders keyed by their corresponding vendor directories.
+     *
+     * @return array<string, self>
+     */
+    public static function getRegisteredLoaders()
+    {
+        return self::$registeredLoaders;
+    }
+
+    /**
+     * @param  string       $class
+     * @param  string       $ext
+     * @return string|false
+     */
+    private function findFileWithExtension($class, $ext)
+    {
+        // PSR-4 lookup
+        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
+
+        $first = $class[0];
+        if (isset($this->prefixLengthsPsr4[$first])) {
+            $subPath = $class;
+            while (false !== $lastPos = strrpos($subPath, '\\')) {
+                $subPath = substr($subPath, 0, $lastPos);
+                $search = $subPath . '\\';
+                if (isset($this->prefixDirsPsr4[$search])) {
+                    $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
+                    foreach ($this->prefixDirsPsr4[$search] as $dir) {
+                        if (file_exists($file = $dir . $pathEnd)) {
+                            return $file;
+                        }
+                    }
+                }
+            }
+        }
+
+        // PSR-4 fallback dirs
+        foreach ($this->fallbackDirsPsr4 as $dir) {
+            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
+                return $file;
+            }
+        }
+
+        // PSR-0 lookup
+        if (false !== $pos = strrpos($class, '\\')) {
+            // namespaced class name
+            $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
+                . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
+        } else {
+            // PEAR-like class name
+            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
+        }
+
+        if (isset($this->prefixesPsr0[$first])) {
+            foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
+                if (0 === strpos($class, $prefix)) {
+                    foreach ($dirs as $dir) {
+                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
+                            return $file;
+                        }
+                    }
+                }
+            }
+        }
+
+        // PSR-0 fallback dirs
+        foreach ($this->fallbackDirsPsr0 as $dir) {
+            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
+                return $file;
+            }
+        }
+
+        // PSR-0 include paths.
+        if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
+            return $file;
+        }
+
+        return false;
+    }
+
+    /**
+     * @return void
+     */
+    private static function initializeIncludeClosure()
+    {
+        if (self::$includeFile !== null) {
+            return;
+        }
+
+        /**
+         * Scope isolated include.
+         *
+         * Prevents access to $this/self from included files.
+         *
+         * @param  string $file
+         * @return void
+         */
+        self::$includeFile = \Closure::bind(static function($file) {
+            include $file;
+        }, null, null);
+    }
+}

+ 396 - 0
vendor/composer/InstalledVersions.php

@@ -0,0 +1,396 @@
+<?php
+
+/*
+ * This file is part of Composer.
+ *
+ * (c) Nils Adermann <naderman@naderman.de>
+ *     Jordi Boggiano <j.boggiano@seld.be>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Composer;
+
+use Composer\Autoload\ClassLoader;
+use Composer\Semver\VersionParser;
+
+/**
+ * This class is copied in every Composer installed project and available to all
+ *
+ * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
+ *
+ * To require its presence, you can require `composer-runtime-api ^2.0`
+ *
+ * @final
+ */
+class InstalledVersions
+{
+    /**
+     * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
+     * @internal
+     */
+    private static $selfDir = null;
+
+    /**
+     * @var mixed[]|null
+     * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
+     */
+    private static $installed;
+
+    /**
+     * @var bool
+     */
+    private static $installedIsLocalDir;
+
+    /**
+     * @var bool|null
+     */
+    private static $canGetVendors;
+
+    /**
+     * @var array[]
+     * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
+     */
+    private static $installedByVendor = array();
+
+    /**
+     * Returns a list of all package names which are present, either by being installed, replaced or provided
+     *
+     * @return string[]
+     * @psalm-return list<string>
+     */
+    public static function getInstalledPackages()
+    {
+        $packages = array();
+        foreach (self::getInstalled() as $installed) {
+            $packages[] = array_keys($installed['versions']);
+        }
+
+        if (1 === \count($packages)) {
+            return $packages[0];
+        }
+
+        return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
+    }
+
+    /**
+     * Returns a list of all package names with a specific type e.g. 'library'
+     *
+     * @param  string   $type
+     * @return string[]
+     * @psalm-return list<string>
+     */
+    public static function getInstalledPackagesByType($type)
+    {
+        $packagesByType = array();
+
+        foreach (self::getInstalled() as $installed) {
+            foreach ($installed['versions'] as $name => $package) {
+                if (isset($package['type']) && $package['type'] === $type) {
+                    $packagesByType[] = $name;
+                }
+            }
+        }
+
+        return $packagesByType;
+    }
+
+    /**
+     * Checks whether the given package is installed
+     *
+     * This also returns true if the package name is provided or replaced by another package
+     *
+     * @param  string $packageName
+     * @param  bool   $includeDevRequirements
+     * @return bool
+     */
+    public static function isInstalled($packageName, $includeDevRequirements = true)
+    {
+        foreach (self::getInstalled() as $installed) {
+            if (isset($installed['versions'][$packageName])) {
+                return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * Checks whether the given package satisfies a version constraint
+     *
+     * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
+     *
+     *   Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
+     *
+     * @param  VersionParser $parser      Install composer/semver to have access to this class and functionality
+     * @param  string        $packageName
+     * @param  string|null   $constraint  A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
+     * @return bool
+     */
+    public static function satisfies(VersionParser $parser, $packageName, $constraint)
+    {
+        $constraint = $parser->parseConstraints((string) $constraint);
+        $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
+
+        return $provided->matches($constraint);
+    }
+
+    /**
+     * Returns a version constraint representing all the range(s) which are installed for a given package
+     *
+     * It is easier to use this via isInstalled() with the $constraint argument if you need to check
+     * whether a given version of a package is installed, and not just whether it exists
+     *
+     * @param  string $packageName
+     * @return string Version constraint usable with composer/semver
+     */
+    public static function getVersionRanges($packageName)
+    {
+        foreach (self::getInstalled() as $installed) {
+            if (!isset($installed['versions'][$packageName])) {
+                continue;
+            }
+
+            $ranges = array();
+            if (isset($installed['versions'][$packageName]['pretty_version'])) {
+                $ranges[] = $installed['versions'][$packageName]['pretty_version'];
+            }
+            if (array_key_exists('aliases', $installed['versions'][$packageName])) {
+                $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
+            }
+            if (array_key_exists('replaced', $installed['versions'][$packageName])) {
+                $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
+            }
+            if (array_key_exists('provided', $installed['versions'][$packageName])) {
+                $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
+            }
+
+            return implode(' || ', $ranges);
+        }
+
+        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
+    }
+
+    /**
+     * @param  string      $packageName
+     * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
+     */
+    public static function getVersion($packageName)
+    {
+        foreach (self::getInstalled() as $installed) {
+            if (!isset($installed['versions'][$packageName])) {
+                continue;
+            }
+
+            if (!isset($installed['versions'][$packageName]['version'])) {
+                return null;
+            }
+
+            return $installed['versions'][$packageName]['version'];
+        }
+
+        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
+    }
+
+    /**
+     * @param  string      $packageName
+     * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
+     */
+    public static function getPrettyVersion($packageName)
+    {
+        foreach (self::getInstalled() as $installed) {
+            if (!isset($installed['versions'][$packageName])) {
+                continue;
+            }
+
+            if (!isset($installed['versions'][$packageName]['pretty_version'])) {
+                return null;
+            }
+
+            return $installed['versions'][$packageName]['pretty_version'];
+        }
+
+        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
+    }
+
+    /**
+     * @param  string      $packageName
+     * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
+     */
+    public static function getReference($packageName)
+    {
+        foreach (self::getInstalled() as $installed) {
+            if (!isset($installed['versions'][$packageName])) {
+                continue;
+            }
+
+            if (!isset($installed['versions'][$packageName]['reference'])) {
+                return null;
+            }
+
+            return $installed['versions'][$packageName]['reference'];
+        }
+
+        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
+    }
+
+    /**
+     * @param  string      $packageName
+     * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
+     */
+    public static function getInstallPath($packageName)
+    {
+        foreach (self::getInstalled() as $installed) {
+            if (!isset($installed['versions'][$packageName])) {
+                continue;
+            }
+
+            return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
+        }
+
+        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
+    }
+
+    /**
+     * @return array
+     * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
+     */
+    public static function getRootPackage()
+    {
+        $installed = self::getInstalled();
+
+        return $installed[0]['root'];
+    }
+
+    /**
+     * Returns the raw installed.php data for custom implementations
+     *
+     * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
+     * @return array[]
+     * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
+     */
+    public static function getRawData()
+    {
+        @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
+
+        if (null === self::$installed) {
+            // only require the installed.php file if this file is loaded from its dumped location,
+            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
+            if (substr(__DIR__, -8, 1) !== 'C') {
+                self::$installed = include __DIR__ . '/installed.php';
+            } else {
+                self::$installed = array();
+            }
+        }
+
+        return self::$installed;
+    }
+
+    /**
+     * Returns the raw data of all installed.php which are currently loaded for custom implementations
+     *
+     * @return array[]
+     * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
+     */
+    public static function getAllRawData()
+    {
+        return self::getInstalled();
+    }
+
+    /**
+     * Lets you reload the static array from another file
+     *
+     * This is only useful for complex integrations in which a project needs to use
+     * this class but then also needs to execute another project's autoloader in process,
+     * and wants to ensure both projects have access to their version of installed.php.
+     *
+     * A typical case would be PHPUnit, where it would need to make sure it reads all
+     * the data it needs from this class, then call reload() with
+     * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
+     * the project in which it runs can then also use this class safely, without
+     * interference between PHPUnit's dependencies and the project's dependencies.
+     *
+     * @param  array[] $data A vendor/composer/installed.php data set
+     * @return void
+     *
+     * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
+     */
+    public static function reload($data)
+    {
+        self::$installed = $data;
+        self::$installedByVendor = array();
+
+        // when using reload, we disable the duplicate protection to ensure that self::$installed data is
+        // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
+        // so we have to assume it does not, and that may result in duplicate data being returned when listing
+        // all installed packages for example
+        self::$installedIsLocalDir = false;
+    }
+
+    /**
+     * @return string
+     */
+    private static function getSelfDir()
+    {
+        if (self::$selfDir === null) {
+            self::$selfDir = strtr(__DIR__, '\\', '/');
+        }
+
+        return self::$selfDir;
+    }
+
+    /**
+     * @return array[]
+     * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
+     */
+    private static function getInstalled()
+    {
+        if (null === self::$canGetVendors) {
+            self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
+        }
+
+        $installed = array();
+        $copiedLocalDir = false;
+
+        if (self::$canGetVendors) {
+            $selfDir = self::getSelfDir();
+            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
+                $vendorDir = strtr($vendorDir, '\\', '/');
+                if (isset(self::$installedByVendor[$vendorDir])) {
+                    $installed[] = self::$installedByVendor[$vendorDir];
+                } elseif (is_file($vendorDir.'/composer/installed.php')) {
+                    /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
+                    $required = require $vendorDir.'/composer/installed.php';
+                    self::$installedByVendor[$vendorDir] = $required;
+                    $installed[] = $required;
+                    if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
+                        self::$installed = $required;
+                        self::$installedIsLocalDir = true;
+                    }
+                }
+                if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
+                    $copiedLocalDir = true;
+                }
+            }
+        }
+
+        if (null === self::$installed) {
+            // only require the installed.php file if this file is loaded from its dumped location,
+            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
+            if (substr(__DIR__, -8, 1) !== 'C') {
+                /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
+                $required = require __DIR__ . '/installed.php';
+                self::$installed = $required;
+            } else {
+                self::$installed = array();
+            }
+        }
+
+        if (self::$installed !== array() && !$copiedLocalDir) {
+            $installed[] = self::$installed;
+        }
+
+        return $installed;
+    }
+}

+ 21 - 0
vendor/composer/LICENSE

@@ -0,0 +1,21 @@
+
+Copyright (c) Nils Adermann, Jordi Boggiano
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+

+ 80 - 0
vendor/composer/autoload_classmap.php

@@ -0,0 +1,80 @@
+<?php
+
+// autoload_classmap.php @generated by Composer
+
+$vendorDir = dirname(__DIR__);
+$baseDir = dirname($vendorDir);
+
+return array(
+    'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
+    'Datamatrix' => $vendorDir . '/tecnickcom/tcpdf/include/barcodes/datamatrix.php',
+    'PDF417' => $vendorDir . '/tecnickcom/tcpdf/include/barcodes/pdf417.php',
+    'PHPMailer\\PHPMailer\\DSNConfigurator' => $vendorDir . '/phpmailer/phpmailer/src/DSNConfigurator.php',
+    'PHPMailer\\PHPMailer\\Exception' => $vendorDir . '/phpmailer/phpmailer/src/Exception.php',
+    'PHPMailer\\PHPMailer\\OAuth' => $vendorDir . '/phpmailer/phpmailer/src/OAuth.php',
+    'PHPMailer\\PHPMailer\\OAuthTokenProvider' => $vendorDir . '/phpmailer/phpmailer/src/OAuthTokenProvider.php',
+    'PHPMailer\\PHPMailer\\PHPMailer' => $vendorDir . '/phpmailer/phpmailer/src/PHPMailer.php',
+    'PHPMailer\\PHPMailer\\POP3' => $vendorDir . '/phpmailer/phpmailer/src/POP3.php',
+    'PHPMailer\\PHPMailer\\SMTP' => $vendorDir . '/phpmailer/phpmailer/src/SMTP.php',
+    'QRcode' => $vendorDir . '/tecnickcom/tcpdf/include/barcodes/qrcode.php',
+    'TCPDF' => $vendorDir . '/tecnickcom/tcpdf/tcpdf.php',
+    'TCPDF2DBarcode' => $vendorDir . '/tecnickcom/tcpdf/tcpdf_barcodes_2d.php',
+    'TCPDFBarcode' => $vendorDir . '/tecnickcom/tcpdf/tcpdf_barcodes_1d.php',
+    'TCPDF_COLORS' => $vendorDir . '/tecnickcom/tcpdf/include/tcpdf_colors.php',
+    'TCPDF_FILTERS' => $vendorDir . '/tecnickcom/tcpdf/include/tcpdf_filters.php',
+    'TCPDF_FONTS' => $vendorDir . '/tecnickcom/tcpdf/include/tcpdf_fonts.php',
+    'TCPDF_FONT_DATA' => $vendorDir . '/tecnickcom/tcpdf/include/tcpdf_font_data.php',
+    'TCPDF_IMAGES' => $vendorDir . '/tecnickcom/tcpdf/include/tcpdf_images.php',
+    'TCPDF_STATIC' => $vendorDir . '/tecnickcom/tcpdf/include/tcpdf_static.php',
+    'setasign\\Fpdi\\FpdfTpl' => $vendorDir . '/setasign/fpdi/src/FpdfTpl.php',
+    'setasign\\Fpdi\\FpdfTplTrait' => $vendorDir . '/setasign/fpdi/src/FpdfTplTrait.php',
+    'setasign\\Fpdi\\FpdfTrait' => $vendorDir . '/setasign/fpdi/src/FpdfTrait.php',
+    'setasign\\Fpdi\\Fpdi' => $vendorDir . '/setasign/fpdi/src/Fpdi.php',
+    'setasign\\Fpdi\\FpdiException' => $vendorDir . '/setasign/fpdi/src/FpdiException.php',
+    'setasign\\Fpdi\\FpdiTrait' => $vendorDir . '/setasign/fpdi/src/FpdiTrait.php',
+    'setasign\\Fpdi\\GraphicsState' => $vendorDir . '/setasign/fpdi/src/GraphicsState.php',
+    'setasign\\Fpdi\\Math\\Matrix' => $vendorDir . '/setasign/fpdi/src/Math/Matrix.php',
+    'setasign\\Fpdi\\Math\\Vector' => $vendorDir . '/setasign/fpdi/src/Math/Vector.php',
+    'setasign\\Fpdi\\PdfParser\\CrossReference\\AbstractReader' => $vendorDir . '/setasign/fpdi/src/PdfParser/CrossReference/AbstractReader.php',
+    'setasign\\Fpdi\\PdfParser\\CrossReference\\CrossReference' => $vendorDir . '/setasign/fpdi/src/PdfParser/CrossReference/CrossReference.php',
+    'setasign\\Fpdi\\PdfParser\\CrossReference\\CrossReferenceException' => $vendorDir . '/setasign/fpdi/src/PdfParser/CrossReference/CrossReferenceException.php',
+    'setasign\\Fpdi\\PdfParser\\CrossReference\\FixedReader' => $vendorDir . '/setasign/fpdi/src/PdfParser/CrossReference/FixedReader.php',
+    'setasign\\Fpdi\\PdfParser\\CrossReference\\LineReader' => $vendorDir . '/setasign/fpdi/src/PdfParser/CrossReference/LineReader.php',
+    'setasign\\Fpdi\\PdfParser\\CrossReference\\ReaderInterface' => $vendorDir . '/setasign/fpdi/src/PdfParser/CrossReference/ReaderInterface.php',
+    'setasign\\Fpdi\\PdfParser\\Filter\\Ascii85' => $vendorDir . '/setasign/fpdi/src/PdfParser/Filter/Ascii85.php',
+    'setasign\\Fpdi\\PdfParser\\Filter\\Ascii85Exception' => $vendorDir . '/setasign/fpdi/src/PdfParser/Filter/Ascii85Exception.php',
+    'setasign\\Fpdi\\PdfParser\\Filter\\AsciiHex' => $vendorDir . '/setasign/fpdi/src/PdfParser/Filter/AsciiHex.php',
+    'setasign\\Fpdi\\PdfParser\\Filter\\FilterException' => $vendorDir . '/setasign/fpdi/src/PdfParser/Filter/FilterException.php',
+    'setasign\\Fpdi\\PdfParser\\Filter\\FilterInterface' => $vendorDir . '/setasign/fpdi/src/PdfParser/Filter/FilterInterface.php',
+    'setasign\\Fpdi\\PdfParser\\Filter\\Flate' => $vendorDir . '/setasign/fpdi/src/PdfParser/Filter/Flate.php',
+    'setasign\\Fpdi\\PdfParser\\Filter\\FlateException' => $vendorDir . '/setasign/fpdi/src/PdfParser/Filter/FlateException.php',
+    'setasign\\Fpdi\\PdfParser\\Filter\\Lzw' => $vendorDir . '/setasign/fpdi/src/PdfParser/Filter/Lzw.php',
+    'setasign\\Fpdi\\PdfParser\\Filter\\LzwException' => $vendorDir . '/setasign/fpdi/src/PdfParser/Filter/LzwException.php',
+    'setasign\\Fpdi\\PdfParser\\PdfParser' => $vendorDir . '/setasign/fpdi/src/PdfParser/PdfParser.php',
+    'setasign\\Fpdi\\PdfParser\\PdfParserException' => $vendorDir . '/setasign/fpdi/src/PdfParser/PdfParserException.php',
+    'setasign\\Fpdi\\PdfParser\\StreamReader' => $vendorDir . '/setasign/fpdi/src/PdfParser/StreamReader.php',
+    'setasign\\Fpdi\\PdfParser\\Tokenizer' => $vendorDir . '/setasign/fpdi/src/PdfParser/Tokenizer.php',
+    'setasign\\Fpdi\\PdfParser\\Type\\PdfArray' => $vendorDir . '/setasign/fpdi/src/PdfParser/Type/PdfArray.php',
+    'setasign\\Fpdi\\PdfParser\\Type\\PdfBoolean' => $vendorDir . '/setasign/fpdi/src/PdfParser/Type/PdfBoolean.php',
+    'setasign\\Fpdi\\PdfParser\\Type\\PdfDictionary' => $vendorDir . '/setasign/fpdi/src/PdfParser/Type/PdfDictionary.php',
+    'setasign\\Fpdi\\PdfParser\\Type\\PdfHexString' => $vendorDir . '/setasign/fpdi/src/PdfParser/Type/PdfHexString.php',
+    'setasign\\Fpdi\\PdfParser\\Type\\PdfIndirectObject' => $vendorDir . '/setasign/fpdi/src/PdfParser/Type/PdfIndirectObject.php',
+    'setasign\\Fpdi\\PdfParser\\Type\\PdfIndirectObjectReference' => $vendorDir . '/setasign/fpdi/src/PdfParser/Type/PdfIndirectObjectReference.php',
+    'setasign\\Fpdi\\PdfParser\\Type\\PdfName' => $vendorDir . '/setasign/fpdi/src/PdfParser/Type/PdfName.php',
+    'setasign\\Fpdi\\PdfParser\\Type\\PdfNull' => $vendorDir . '/setasign/fpdi/src/PdfParser/Type/PdfNull.php',
+    'setasign\\Fpdi\\PdfParser\\Type\\PdfNumeric' => $vendorDir . '/setasign/fpdi/src/PdfParser/Type/PdfNumeric.php',
+    'setasign\\Fpdi\\PdfParser\\Type\\PdfStream' => $vendorDir . '/setasign/fpdi/src/PdfParser/Type/PdfStream.php',
+    'setasign\\Fpdi\\PdfParser\\Type\\PdfString' => $vendorDir . '/setasign/fpdi/src/PdfParser/Type/PdfString.php',
+    'setasign\\Fpdi\\PdfParser\\Type\\PdfToken' => $vendorDir . '/setasign/fpdi/src/PdfParser/Type/PdfToken.php',
+    'setasign\\Fpdi\\PdfParser\\Type\\PdfType' => $vendorDir . '/setasign/fpdi/src/PdfParser/Type/PdfType.php',
+    'setasign\\Fpdi\\PdfParser\\Type\\PdfTypeException' => $vendorDir . '/setasign/fpdi/src/PdfParser/Type/PdfTypeException.php',
+    'setasign\\Fpdi\\PdfReader\\DataStructure\\Rectangle' => $vendorDir . '/setasign/fpdi/src/PdfReader/DataStructure/Rectangle.php',
+    'setasign\\Fpdi\\PdfReader\\Page' => $vendorDir . '/setasign/fpdi/src/PdfReader/Page.php',
+    'setasign\\Fpdi\\PdfReader\\PageBoundaries' => $vendorDir . '/setasign/fpdi/src/PdfReader/PageBoundaries.php',
+    'setasign\\Fpdi\\PdfReader\\PdfReader' => $vendorDir . '/setasign/fpdi/src/PdfReader/PdfReader.php',
+    'setasign\\Fpdi\\PdfReader\\PdfReaderException' => $vendorDir . '/setasign/fpdi/src/PdfReader/PdfReaderException.php',
+    'setasign\\Fpdi\\TcpdfFpdi' => $vendorDir . '/setasign/fpdi/src/TcpdfFpdi.php',
+    'setasign\\Fpdi\\Tcpdf\\Fpdi' => $vendorDir . '/setasign/fpdi/src/Tcpdf/Fpdi.php',
+    'setasign\\Fpdi\\Tfpdf\\FpdfTpl' => $vendorDir . '/setasign/fpdi/src/Tfpdf/FpdfTpl.php',
+    'setasign\\Fpdi\\Tfpdf\\Fpdi' => $vendorDir . '/setasign/fpdi/src/Tfpdf/Fpdi.php',
+);

+ 9 - 0
vendor/composer/autoload_namespaces.php

@@ -0,0 +1,9 @@
+<?php
+
+// autoload_namespaces.php @generated by Composer
+
+$vendorDir = dirname(__DIR__);
+$baseDir = dirname($vendorDir);
+
+return array(
+);

+ 11 - 0
vendor/composer/autoload_psr4.php

@@ -0,0 +1,11 @@
+<?php
+
+// autoload_psr4.php @generated by Composer
+
+$vendorDir = dirname(__DIR__);
+$baseDir = dirname($vendorDir);
+
+return array(
+    'setasign\\Fpdi\\' => array($vendorDir . '/setasign/fpdi/src'),
+    'PHPMailer\\PHPMailer\\' => array($vendorDir . '/phpmailer/phpmailer/src'),
+);

+ 36 - 0
vendor/composer/autoload_real.php

@@ -0,0 +1,36 @@
+<?php
+
+// autoload_real.php @generated by Composer
+
+class ComposerAutoloaderInitc4d2c538d2df0a0f21bbe8fb0b8f7609
+{
+    private static $loader;
+
+    public static function loadClassLoader($class)
+    {
+        if ('Composer\Autoload\ClassLoader' === $class) {
+            require __DIR__ . '/ClassLoader.php';
+        }
+    }
+
+    /**
+     * @return \Composer\Autoload\ClassLoader
+     */
+    public static function getLoader()
+    {
+        if (null !== self::$loader) {
+            return self::$loader;
+        }
+
+        spl_autoload_register(array('ComposerAutoloaderInitc4d2c538d2df0a0f21bbe8fb0b8f7609', 'loadClassLoader'), true, true);
+        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
+        spl_autoload_unregister(array('ComposerAutoloaderInitc4d2c538d2df0a0f21bbe8fb0b8f7609', 'loadClassLoader'));
+
+        require __DIR__ . '/autoload_static.php';
+        call_user_func(\Composer\Autoload\ComposerStaticInitc4d2c538d2df0a0f21bbe8fb0b8f7609::getInitializer($loader));
+
+        $loader->register(true);
+
+        return $loader;
+    }
+}

+ 114 - 0
vendor/composer/autoload_static.php

@@ -0,0 +1,114 @@
+<?php
+
+// autoload_static.php @generated by Composer
+
+namespace Composer\Autoload;
+
+class ComposerStaticInitc4d2c538d2df0a0f21bbe8fb0b8f7609
+{
+    public static $prefixLengthsPsr4 = array (
+        's' =>
+        array (
+            'setasign\\Fpdi\\' => 14,
+        ),
+        'P' =>
+        array (
+            'PHPMailer\\PHPMailer\\' => 20,
+        ),
+    );
+
+    public static $prefixDirsPsr4 = array (
+        'setasign\\Fpdi\\' =>
+        array (
+            0 => __DIR__ . '/..' . '/setasign/fpdi/src',
+        ),
+        'PHPMailer\\PHPMailer\\' =>
+        array (
+            0 => __DIR__ . '/..' . '/phpmailer/phpmailer/src',
+        ),
+    );
+
+    public static $classMap = array (
+        'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
+        'Datamatrix' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/barcodes/datamatrix.php',
+        'PDF417' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/barcodes/pdf417.php',
+        'PHPMailer\\PHPMailer\\DSNConfigurator' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/DSNConfigurator.php',
+        'PHPMailer\\PHPMailer\\Exception' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/Exception.php',
+        'PHPMailer\\PHPMailer\\OAuth' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/OAuth.php',
+        'PHPMailer\\PHPMailer\\OAuthTokenProvider' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/OAuthTokenProvider.php',
+        'PHPMailer\\PHPMailer\\PHPMailer' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/PHPMailer.php',
+        'PHPMailer\\PHPMailer\\POP3' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/POP3.php',
+        'PHPMailer\\PHPMailer\\SMTP' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/SMTP.php',
+        'QRcode' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/barcodes/qrcode.php',
+        'TCPDF' => __DIR__ . '/..' . '/tecnickcom/tcpdf/tcpdf.php',
+        'TCPDF2DBarcode' => __DIR__ . '/..' . '/tecnickcom/tcpdf/tcpdf_barcodes_2d.php',
+        'TCPDFBarcode' => __DIR__ . '/..' . '/tecnickcom/tcpdf/tcpdf_barcodes_1d.php',
+        'TCPDF_COLORS' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/tcpdf_colors.php',
+        'TCPDF_FILTERS' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/tcpdf_filters.php',
+        'TCPDF_FONTS' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/tcpdf_fonts.php',
+        'TCPDF_FONT_DATA' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/tcpdf_font_data.php',
+        'TCPDF_IMAGES' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/tcpdf_images.php',
+        'TCPDF_STATIC' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/tcpdf_static.php',
+        'setasign\\Fpdi\\FpdfTpl' => __DIR__ . '/..' . '/setasign/fpdi/src/FpdfTpl.php',
+        'setasign\\Fpdi\\FpdfTplTrait' => __DIR__ . '/..' . '/setasign/fpdi/src/FpdfTplTrait.php',
+        'setasign\\Fpdi\\FpdfTrait' => __DIR__ . '/..' . '/setasign/fpdi/src/FpdfTrait.php',
+        'setasign\\Fpdi\\Fpdi' => __DIR__ . '/..' . '/setasign/fpdi/src/Fpdi.php',
+        'setasign\\Fpdi\\FpdiException' => __DIR__ . '/..' . '/setasign/fpdi/src/FpdiException.php',
+        'setasign\\Fpdi\\FpdiTrait' => __DIR__ . '/..' . '/setasign/fpdi/src/FpdiTrait.php',
+        'setasign\\Fpdi\\GraphicsState' => __DIR__ . '/..' . '/setasign/fpdi/src/GraphicsState.php',
+        'setasign\\Fpdi\\Math\\Matrix' => __DIR__ . '/..' . '/setasign/fpdi/src/Math/Matrix.php',
+        'setasign\\Fpdi\\Math\\Vector' => __DIR__ . '/..' . '/setasign/fpdi/src/Math/Vector.php',
+        'setasign\\Fpdi\\PdfParser\\CrossReference\\AbstractReader' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/CrossReference/AbstractReader.php',
+        'setasign\\Fpdi\\PdfParser\\CrossReference\\CrossReference' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/CrossReference/CrossReference.php',
+        'setasign\\Fpdi\\PdfParser\\CrossReference\\CrossReferenceException' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/CrossReference/CrossReferenceException.php',
+        'setasign\\Fpdi\\PdfParser\\CrossReference\\FixedReader' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/CrossReference/FixedReader.php',
+        'setasign\\Fpdi\\PdfParser\\CrossReference\\LineReader' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/CrossReference/LineReader.php',
+        'setasign\\Fpdi\\PdfParser\\CrossReference\\ReaderInterface' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/CrossReference/ReaderInterface.php',
+        'setasign\\Fpdi\\PdfParser\\Filter\\Ascii85' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Filter/Ascii85.php',
+        'setasign\\Fpdi\\PdfParser\\Filter\\Ascii85Exception' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Filter/Ascii85Exception.php',
+        'setasign\\Fpdi\\PdfParser\\Filter\\AsciiHex' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Filter/AsciiHex.php',
+        'setasign\\Fpdi\\PdfParser\\Filter\\FilterException' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Filter/FilterException.php',
+        'setasign\\Fpdi\\PdfParser\\Filter\\FilterInterface' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Filter/FilterInterface.php',
+        'setasign\\Fpdi\\PdfParser\\Filter\\Flate' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Filter/Flate.php',
+        'setasign\\Fpdi\\PdfParser\\Filter\\FlateException' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Filter/FlateException.php',
+        'setasign\\Fpdi\\PdfParser\\Filter\\Lzw' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Filter/Lzw.php',
+        'setasign\\Fpdi\\PdfParser\\Filter\\LzwException' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Filter/LzwException.php',
+        'setasign\\Fpdi\\PdfParser\\PdfParser' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/PdfParser.php',
+        'setasign\\Fpdi\\PdfParser\\PdfParserException' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/PdfParserException.php',
+        'setasign\\Fpdi\\PdfParser\\StreamReader' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/StreamReader.php',
+        'setasign\\Fpdi\\PdfParser\\Tokenizer' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Tokenizer.php',
+        'setasign\\Fpdi\\PdfParser\\Type\\PdfArray' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Type/PdfArray.php',
+        'setasign\\Fpdi\\PdfParser\\Type\\PdfBoolean' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Type/PdfBoolean.php',
+        'setasign\\Fpdi\\PdfParser\\Type\\PdfDictionary' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Type/PdfDictionary.php',
+        'setasign\\Fpdi\\PdfParser\\Type\\PdfHexString' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Type/PdfHexString.php',
+        'setasign\\Fpdi\\PdfParser\\Type\\PdfIndirectObject' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Type/PdfIndirectObject.php',
+        'setasign\\Fpdi\\PdfParser\\Type\\PdfIndirectObjectReference' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Type/PdfIndirectObjectReference.php',
+        'setasign\\Fpdi\\PdfParser\\Type\\PdfName' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Type/PdfName.php',
+        'setasign\\Fpdi\\PdfParser\\Type\\PdfNull' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Type/PdfNull.php',
+        'setasign\\Fpdi\\PdfParser\\Type\\PdfNumeric' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Type/PdfNumeric.php',
+        'setasign\\Fpdi\\PdfParser\\Type\\PdfStream' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Type/PdfStream.php',
+        'setasign\\Fpdi\\PdfParser\\Type\\PdfString' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Type/PdfString.php',
+        'setasign\\Fpdi\\PdfParser\\Type\\PdfToken' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Type/PdfToken.php',
+        'setasign\\Fpdi\\PdfParser\\Type\\PdfType' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Type/PdfType.php',
+        'setasign\\Fpdi\\PdfParser\\Type\\PdfTypeException' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfParser/Type/PdfTypeException.php',
+        'setasign\\Fpdi\\PdfReader\\DataStructure\\Rectangle' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfReader/DataStructure/Rectangle.php',
+        'setasign\\Fpdi\\PdfReader\\Page' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfReader/Page.php',
+        'setasign\\Fpdi\\PdfReader\\PageBoundaries' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfReader/PageBoundaries.php',
+        'setasign\\Fpdi\\PdfReader\\PdfReader' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfReader/PdfReader.php',
+        'setasign\\Fpdi\\PdfReader\\PdfReaderException' => __DIR__ . '/..' . '/setasign/fpdi/src/PdfReader/PdfReaderException.php',
+        'setasign\\Fpdi\\TcpdfFpdi' => __DIR__ . '/..' . '/setasign/fpdi/src/TcpdfFpdi.php',
+        'setasign\\Fpdi\\Tcpdf\\Fpdi' => __DIR__ . '/..' . '/setasign/fpdi/src/Tcpdf/Fpdi.php',
+        'setasign\\Fpdi\\Tfpdf\\FpdfTpl' => __DIR__ . '/..' . '/setasign/fpdi/src/Tfpdf/FpdfTpl.php',
+        'setasign\\Fpdi\\Tfpdf\\Fpdi' => __DIR__ . '/..' . '/setasign/fpdi/src/Tfpdf/Fpdi.php',
+    );
+
+    public static function getInitializer(ClassLoader $loader)
+    {
+        return \Closure::bind(function () use ($loader) {
+            $loader->prefixLengthsPsr4 = ComposerStaticInitc4d2c538d2df0a0f21bbe8fb0b8f7609::$prefixLengthsPsr4;
+            $loader->prefixDirsPsr4 = ComposerStaticInitc4d2c538d2df0a0f21bbe8fb0b8f7609::$prefixDirsPsr4;
+            $loader->classMap = ComposerStaticInitc4d2c538d2df0a0f21bbe8fb0b8f7609::$classMap;
+
+        }, null, ClassLoader::class);
+    }
+}

+ 239 - 0
vendor/composer/installed.json

@@ -0,0 +1,239 @@
+{
+    "packages": [
+        {
+            "name": "phpmailer/phpmailer",
+            "version": "v6.12.0",
+            "version_normalized": "6.12.0.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/PHPMailer/PHPMailer.git",
+                "reference": "d1ac35d784bf9f5e61b424901d5a014967f15b12"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/d1ac35d784bf9f5e61b424901d5a014967f15b12",
+                "reference": "d1ac35d784bf9f5e61b424901d5a014967f15b12",
+                "shasum": ""
+            },
+            "require": {
+                "ext-ctype": "*",
+                "ext-filter": "*",
+                "ext-hash": "*",
+                "php": ">=5.5.0"
+            },
+            "require-dev": {
+                "dealerdirect/phpcodesniffer-composer-installer": "^1.0",
+                "doctrine/annotations": "^1.2.6 || ^1.13.3",
+                "php-parallel-lint/php-console-highlighter": "^1.0.0",
+                "php-parallel-lint/php-parallel-lint": "^1.3.2",
+                "phpcompatibility/php-compatibility": "^9.3.5",
+                "roave/security-advisories": "dev-latest",
+                "squizlabs/php_codesniffer": "^3.7.2",
+                "yoast/phpunit-polyfills": "^1.0.4"
+            },
+            "suggest": {
+                "decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication",
+                "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses",
+                "ext-openssl": "Needed for secure SMTP sending and DKIM signing",
+                "greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication",
+                "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
+                "league/oauth2-google": "Needed for Google XOAUTH2 authentication",
+                "psr/log": "For optional PSR-3 debug logging",
+                "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)",
+                "thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication"
+            },
+            "time": "2025-10-15T16:49:08+00:00",
+            "type": "library",
+            "installation-source": "source",
+            "autoload": {
+                "psr-4": {
+                    "PHPMailer\\PHPMailer\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "LGPL-2.1-only"
+            ],
+            "authors": [
+                {
+                    "name": "Marcus Bointon",
+                    "email": "phpmailer@synchromedia.co.uk"
+                },
+                {
+                    "name": "Jim Jagielski",
+                    "email": "jimjag@gmail.com"
+                },
+                {
+                    "name": "Andy Prevost",
+                    "email": "codeworxtech@users.sourceforge.net"
+                },
+                {
+                    "name": "Brent R. Matzelle"
+                }
+            ],
+            "description": "PHPMailer is a full-featured email creation and transfer class for PHP",
+            "support": {
+                "issues": "https://github.com/PHPMailer/PHPMailer/issues",
+                "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.12.0"
+            },
+            "funding": [
+                {
+                    "url": "https://github.com/Synchro",
+                    "type": "github"
+                }
+            ],
+            "install-path": "../phpmailer/phpmailer"
+        },
+        {
+            "name": "setasign/fpdi",
+            "version": "v2.6.4",
+            "version_normalized": "2.6.4.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/Setasign/FPDI.git",
+                "reference": "4b53852fde2734ec6a07e458a085db627c60eada"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/Setasign/FPDI/zipball/4b53852fde2734ec6a07e458a085db627c60eada",
+                "reference": "4b53852fde2734ec6a07e458a085db627c60eada",
+                "shasum": ""
+            },
+            "require": {
+                "ext-zlib": "*",
+                "php": "^7.1 || ^8.0"
+            },
+            "conflict": {
+                "setasign/tfpdf": "<1.31"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^7",
+                "setasign/fpdf": "~1.8.6",
+                "setasign/tfpdf": "~1.33",
+                "squizlabs/php_codesniffer": "^3.5",
+                "tecnickcom/tcpdf": "^6.8"
+            },
+            "suggest": {
+                "setasign/fpdf": "FPDI will extend this class but as it is also possible to use TCPDF or tFPDF as an alternative. There's no fixed dependency configured."
+            },
+            "time": "2025-08-05T09:57:14+00:00",
+            "type": "library",
+            "installation-source": "source",
+            "autoload": {
+                "psr-4": {
+                    "setasign\\Fpdi\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Jan Slabon",
+                    "email": "jan.slabon@setasign.com",
+                    "homepage": "https://www.setasign.com"
+                },
+                {
+                    "name": "Maximilian Kresse",
+                    "email": "maximilian.kresse@setasign.com",
+                    "homepage": "https://www.setasign.com"
+                }
+            ],
+            "description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.",
+            "homepage": "https://www.setasign.com/fpdi",
+            "keywords": [
+                "fpdf",
+                "fpdi",
+                "pdf"
+            ],
+            "support": {
+                "issues": "https://github.com/Setasign/FPDI/issues",
+                "source": "https://github.com/Setasign/FPDI/tree/v2.6.4"
+            },
+            "funding": [
+                {
+                    "url": "https://tidelift.com/funding/github/packagist/setasign/fpdi",
+                    "type": "tidelift"
+                }
+            ],
+            "install-path": "../setasign/fpdi"
+        },
+        {
+            "name": "tecnickcom/tcpdf",
+            "version": "6.11.2",
+            "version_normalized": "6.11.2.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/tecnickcom/TCPDF.git",
+                "reference": "e1e2ade18e574e963473f53271591edd8c0033ec"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/e1e2ade18e574e963473f53271591edd8c0033ec",
+                "reference": "e1e2ade18e574e963473f53271591edd8c0033ec",
+                "shasum": ""
+            },
+            "require": {
+                "ext-curl": "*",
+                "php": ">=7.1.0"
+            },
+            "time": "2026-03-03T08:58:10+00:00",
+            "type": "library",
+            "installation-source": "source",
+            "autoload": {
+                "classmap": [
+                    "config",
+                    "include",
+                    "tcpdf.php",
+                    "tcpdf_barcodes_1d.php",
+                    "tcpdf_barcodes_2d.php",
+                    "include/tcpdf_colors.php",
+                    "include/tcpdf_filters.php",
+                    "include/tcpdf_font_data.php",
+                    "include/tcpdf_fonts.php",
+                    "include/tcpdf_images.php",
+                    "include/tcpdf_static.php",
+                    "include/barcodes/datamatrix.php",
+                    "include/barcodes/pdf417.php",
+                    "include/barcodes/qrcode.php"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "LGPL-3.0-or-later"
+            ],
+            "authors": [
+                {
+                    "name": "Nicola Asuni",
+                    "email": "info@tecnick.com",
+                    "role": "lead"
+                }
+            ],
+            "description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
+            "homepage": "http://www.tcpdf.org/",
+            "keywords": [
+                "PDFD32000-2008",
+                "TCPDF",
+                "barcodes",
+                "datamatrix",
+                "pdf",
+                "pdf417",
+                "qrcode"
+            ],
+            "support": {
+                "issues": "https://github.com/tecnickcom/TCPDF/issues",
+                "source": "https://github.com/tecnickcom/TCPDF/tree/6.11.2"
+            },
+            "funding": [
+                {
+                    "url": "https://www.paypal.com/donate/?hosted_button_id=NZUEC5XS8MFBJ",
+                    "type": "custom"
+                }
+            ],
+            "install-path": "../tecnickcom/tcpdf"
+        }
+    ],
+    "dev": true,
+    "dev-package-names": []
+}

+ 50 - 0
vendor/composer/installed.php

@@ -0,0 +1,50 @@
+<?php return array(
+    'root' => array(
+        'name' => 'feuerwehr-freising/mitgliedsantrag',
+        'pretty_version' => 'dev-main',
+        'version' => 'dev-main',
+        'reference' => 'ac5cdf96e04199147ece6fce5e146b9e2ed5e839',
+        'type' => 'project',
+        'install_path' => __DIR__ . '/../../',
+        'aliases' => array(),
+        'dev' => true,
+    ),
+    'versions' => array(
+        'feuerwehr-freising/mitgliedsantrag' => array(
+            'pretty_version' => 'dev-main',
+            'version' => 'dev-main',
+            'reference' => 'ac5cdf96e04199147ece6fce5e146b9e2ed5e839',
+            'type' => 'project',
+            'install_path' => __DIR__ . '/../../',
+            'aliases' => array(),
+            'dev_requirement' => false,
+        ),
+        'phpmailer/phpmailer' => array(
+            'pretty_version' => 'v6.12.0',
+            'version' => '6.12.0.0',
+            'reference' => 'd1ac35d784bf9f5e61b424901d5a014967f15b12',
+            'type' => 'library',
+            'install_path' => __DIR__ . '/../phpmailer/phpmailer',
+            'aliases' => array(),
+            'dev_requirement' => false,
+        ),
+        'setasign/fpdi' => array(
+            'pretty_version' => 'v2.6.4',
+            'version' => '2.6.4.0',
+            'reference' => '4b53852fde2734ec6a07e458a085db627c60eada',
+            'type' => 'library',
+            'install_path' => __DIR__ . '/../setasign/fpdi',
+            'aliases' => array(),
+            'dev_requirement' => false,
+        ),
+        'tecnickcom/tcpdf' => array(
+            'pretty_version' => '6.11.2',
+            'version' => '6.11.2.0',
+            'reference' => 'e1e2ade18e574e963473f53271591edd8c0033ec',
+            'type' => 'library',
+            'install_path' => __DIR__ . '/../tecnickcom/tcpdf',
+            'aliases' => array(),
+            'dev_requirement' => false,
+        ),
+    ),
+);

+ 1 - 0
vendor/phpmailer/phpmailer

@@ -0,0 +1 @@
+Subproject commit d1ac35d784bf9f5e61b424901d5a014967f15b12

+ 1 - 0
vendor/setasign/fpdi

@@ -0,0 +1 @@
+Subproject commit 4b53852fde2734ec6a07e458a085db627c60eada

+ 1 - 0
vendor/tecnickcom/tcpdf

@@ -0,0 +1 @@
+Subproject commit e1e2ade18e574e963473f53271591edd8c0033ec