wiki/content/20201116132411-hostname_constraint.md

385 B

id title
de7c8974-5636-4e6d-baf7-afc90985c535 Hostname Constraint

Description

Validates hostname

Syntax

// src/Entity/ServerSettings.php
namespace App\Entity;

use Symfony\Component\Validator\Constraints as Assert;

class ServerSettings
{
    /**
     * @Assert\Hostname(message="The server name must be a valid hostname.")
     */
    protected $name;
}