wiki/content/20201116132411-hostname_constraint.md

27 lines
402 B
Markdown
Raw Permalink Normal View History

2024-05-06 20:40:05 +00:00
---
2024-10-30 17:34:11 +00:00
date: 2020-11-16
2024-05-06 20:40:05 +00:00
id: de7c8974-5636-4e6d-baf7-afc90985c535
title: Hostname Constraint
---
# Description
Validates hostname
# Syntax
``` php
// 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;
}
```