for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace App\Contact;
use Yiisoft\Form\FormModel;
use Yiisoft\Validator\Rule\Email;
use Yiisoft\Validator\Rule\Required;
final class ContactForm extends FormModel
{
private string $username = '';
$username
private string $email = '';
$email
private string $subject = '';
$subject
private string $body = '';
$body
private ?array $attachFiles = null;
$attachFiles
public function attributeLabels(): array
return [
'username' => 'Username',
'email' => 'Email',
'subject' => 'Subject',
'body' => 'Body',
];
}
public function formName(): string
return 'ContactForm';
public function rules(): array
'username' => [new Required()],
'email' => [new Required(), new Email()],
'subject' => [new Required()],
'body' => [new Required()],