1. Go to this page and download the library: Download akyos/ux-forms library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// src/Contract/ContactFormSubmissionHandlerInterface.php
public function handle(ContactForm $contactForm, array $values): void;
// src/Contact/MySubmissionHandler.php
namespace App\Contact;
use Akyos\UXForms\Contract\ContactFormSubmissionHandlerInterface;
use Akyos\UXForms\Entity\ContactForm;
final class MySubmissionHandler implements ContactFormSubmissionHandlerInterface
{
public function handle(ContactForm $contactForm, array $values): void
{
// CRM, webhook, persistance custom…
}
}
final class LoggingSubmissionHandler implements ContactFormSubmissionHandlerInterface
{
public function __construct(
private ContactFormSubmissionHandler $inner,
private LoggerInterface $logger,
) {}
public function handle(ContactForm $contactForm, array $values): void
{
$this->inner->handle($contactForm, $values);
$this->logger->info('Contact form submitted', ['id' => $contactForm->getId()]);
}
}
// Injection directe si besoin (CLI, listener…)
public function __construct(
private ContactFormSubmissionService $submissionService,
) {}
Visiteur submit
→ PublicForm (LiveComponent)
→ ContactFormSubmissionHandlerInterface::handle()
→ ContactFormSubmissionService::submit()
1. Snapshot des champs en BDD (contact_form_submission)
2. Envoi e-mail via ContactFormMailer
3. Mise à jour du statut (sent / failed)