class TTLValidator (View source)

DNS TTL validation service

Validates Time To Live (TTL) values according to:

  • RFC 1034: Domain Names - Concepts and Facilities
  • RFC 1035: Domain Names - Implementation and Specification
  • RFC 2181: Clarifications to the DNS Specification (Section 8)

TTL values define how long DNS records should be cached by resolvers. According to RFC 2181, TTL values are unsigned 32-bit integers (0-4294967295), although practical implementations typically use much lower values.

Constants

private TTL_MIN

RFC limits and recommendations for TTL values

private TTL_MAX

private TTL_RECOMMENDED_MIN

private TTL_RECOMMENDED_MAX

private TTL_RECOMMENDED_SOA_MIN

Methods

validate(mixed $ttl, mixed $defaultTtl, bool $checkRecommended = false, string $recordType = '')

Validate TTL value according to RFC standards and best practices

validateForRecordType(mixed $ttl, mixed $defaultTtl, string $recordType)

Validate TTL value for a specific record type

Details

ValidationResult validate(mixed $ttl, mixed $defaultTtl, bool $checkRecommended = false, string $recordType = '')

Validate TTL value according to RFC standards and best practices

Parameters

mixed $ttl

TTL value to validate

mixed $defaultTtl

Default TTL to use if ttl is not provided

bool $checkRecommended

Whether to also check recommended ranges (warning only)

string $recordType

Record type for specialized recommendations (optional)

Return Value

ValidationResult

Validation result with TTL value, warnings, or error

ValidationResult validateForRecordType(mixed $ttl, mixed $defaultTtl, string $recordType)

Validate TTL value for a specific record type

Parameters

mixed $ttl

TTL value to validate

mixed $defaultTtl

Default TTL to use if ttl is not provided

string $recordType

Record type for specialized recommendations

Return Value

ValidationResult

Validation result with TTL value, warnings, or error