Lue dans les fichiers PHP du paquet au commit 947a85a5eb08 : ses espaces de noms, classes, interfaces et énumérations, leurs constantes, propriétés et méthodes publiques avec leur PHPDoc, et les options que prennent ses fabriques. Rien n’en est exécuté.
AvailabilityInterfaceinterfaceWhether a domain can be registered here, and at what price.
1 method
CapabilitiesclassWhat a provider can be asked, said before it is asked anything, and whose terms apply.
3 methods · 7 properties
ConfigclassA provider's configuration while its factory builds it: the options given, the factory's defaults under them, and the keys that must be filled.
7 methods
DnsInterfaceinterfaceThe records of a zone the provider serves. A record is found by its id when the provider gives one, else by its name, type and content (Record::sameAs()).
4 methods
DomainsInterfaceinterfaceThe domains the account holds, and each one's term.
2 methods
NameserversInterfaceinterfaceThe name servers a registered domain delegates to.
2 methods
ProviderFactoryclassA provider's factory fills a Config - its name ("omnidns.factory_name"), its title ("omnidns.factory_title"), the options it needs ("omnidns.required_options") and the defaults of the others - then builds the provider from it.
3 methods
ProviderFactoryInterfaceinterfaceBuilds a provider from its options (a key, a token...).
2 methods
ProviderInterfaceinterfaceOne provider where domains are registered or their DNS is served, configured: OVH, Gandi, Cloudflare, Scaleway... Its Capabilities say what it can be asked - is a domain free (AvailabilityInterface), register or renew it (RegistrarInterface), the domains the account holds and when they end (DomainsInterface), their name servers (NameserversInterface), the records of a zone (DnsInterface) - and whose terms apply.
3 methods
RegistrarInterfaceinterfaceRegistering a domain and renewing it - orders that cost money: each provider says in its README whether the order is paid at once (the account's means of payment) or waits for a payment at Order::$paymentUrl.
2 methods
RegistryclassThe application's domain and DNS providers by name, each built once from its factory and options:
11 methods
InvalidArgumentExceptionclassA value no provider can take: a malformed domain name, a record type unknown, a duration of zero years.
InvalidConfigExceptionclassA provider asked for with options it cannot work with, or not configured at all.
NotSupportedExceptionclassA provider asked for what it cannot give: a registration asked of a provider that only hosts DNS.
1 method
OmnidnsExceptioninterfaceEvery exception omnidns throws.
ProviderExceptionclassThe provider answered, and not with what was asked: an error status, a domain not in the account, an order refused.
1 method
UnreachableExceptionclassThe provider could not be reached: a network error, a timeout.
JsonclassA JSON request on the application's HTTP client, its failures turned into omnidns's exceptions (an empty answer is an empty array); and typed reads of what came back, for providers that walk an answer they do not control.
7 methods
RedactionclassWhat a failed call may carry of its credentials, taken out before the failure leaves the package: an HTTP client's exception quotes the URL called (a key in its query, a password in its user part), and every exception's trace keeps the arguments of the calls under it (the request options, headers and query with the key) unless PHP runs with zend.exception_ignore_args.
5 methods · 1 constant
AvailabilityclassWhether a domain can be registered, and at what price when the provider quotes one: the first year's (Gandi: before taxes; OVH: its "TOTAL"), and the renewal's when it says.
2 methods · 6 properties
ContactclassThe domain's owner (registrant), as a registry needs them - or a contact the provider already holds, named by its handle (an OVH /me/contact id, a Scaleway contact id): then the rest may stay empty.
3 methods · 11 properties · 3 constants
DomainInfoclassA domain the account holds, as its registrar shows it: when it ends, whether it renews itself, its statuses, its name servers when the provider gives them in the same answer (null: ask NameserversInterface).
3 methods · 6 properties
DomainNameclassA domain name as every provider is asked it: lower case, no trailing dot, labels a registry accepts.
1 method
MoneyclassA price in hundredths of its currency's unit (8.39 EUR: 839), and its ISO 4217 currency.
5 methods · 2 properties
OrderclassWhat a registration or a renewal left with the provider: its order or task, its state, its price and, when it waits for a payment, where to pay.
2 methods · 7 properties · 2 constants
RecordclassOne DNS record of a zone: its type, its name relative to the zone ("" for the apex, "www", "_dmarc"), its content (an address, a host, a text), its TTL (null: the zone's default) and, for MX, its priority apart. A provider that names records gives its id; one that groups them by name and type (Gandi's rrsets) gives none, and a record is then known by its name, type and content. Options are what one provider keeps besides (Cloudflare's "proxied"), handed back to it on an update.
10 methods · 7 properties · 1 constant
MemoryFactoryclassMemoryProvider, from its options:
3 options
MemoryProviderclassA registrar and a DNS host in memory, every contract answered: for tests, demos and an application's fixtures. A domain registered is held for the years asked, served by ns1/ns2.memory.test, its zone empty.
15 methods
Omnidns
AvailabilityInterface interface
interface AvailabilityInterface extends ProviderInterface AvailabilityInterface.php:8
Whether a domain can be registered here, and at what price.
AvailabilityInterface::check()
public function check(string $domain): AvailabilityCapabilities class
final readonly class Capabilities Capabilities.php:6
What a provider can be asked, said before it is asked anything, and whose terms apply.
public bool $availabilitywhether a domain is free, its price (AvailabilityInterface)
public bool $registrarregistering and renewing (RegistrarInterface)
public bool $domainsthe account's domains and their terms (DomainsInterface)
public bool $nameserversa domain's name servers (NameserversInterface)
public bool $dnsa zone's records (DnsInterface)
public array $recordTypesthe record types its DNS takes
public array $termsthe terms whoever runs it must follow (URLs)
Capabilities::__construct()
public function __construct(public bool $availability = false, public bool $registrar = false, public bool $domains = false, public bool $nameservers = false, public bool $dns = false, public array $recordTypes = [], public array $terms = [])$availabilitywhether a domain is free, its price (AvailabilityInterface)
$registrarregistering and renewing (RegistrarInterface)
$domainsthe account's domains and their terms (DomainsInterface)
$nameserversa domain's name servers (NameserversInterface)
$dnsa zone's records (DnsInterface)
$recordTypesthe record types its DNS takes
$termsthe terms whoever runs it must follow (URLs)
Capabilities::contracts()
public function contracts(): array- Returns
what it can be asked, by contract
Capabilities::toArray()
public function toArray(): arrayConfig class
final class Config extends ArrayObject Config.php:14
A provider's configuration while its factory builds it: the options given, the factory's defaults under them, and the keys that must be filled.
Config::defaults()
public function defaults(array $defaults): selfSets each key not set yet.
Config::validateNotEmpty()
public function validateNotEmpty(array $keys): voidConfig::get()
public function get(string $key, mixed $default = null): mixedConfig::string()
public function string(string $key): ?stringA string option; null when it is empty.
Config::int()
public function int(string $key, int $default = 0): intConfig::float()
public function float(string $key, float $default = 0.0): floatConfig::bool()
public function bool(string $key): boolA boolean option, as an environment variable gives it too: "1", "true", "yes", "on".
DnsInterface interface
interface DnsInterface extends ProviderInterface DnsInterface.php:12
The records of a zone the provider serves. A record is found by its id when the provider gives one, else by its name, type and content (Record::sameAs()).
DnsInterface::records()
public function records(string $zone, ?string $type = null, ?string $name = null): array$typea record type ("MX"); null: every type
$namea name relative to the zone ("" for the apex); null: every name
DnsInterface::add()
public function add(string $zone, Record $record): Record- Returns
the record added, with its id when the provider gives one
DnsInterface::update()
public function update(string $zone, Record $current, Record $new): Record- Returns
the record as it now is
DnsInterface::delete()
public function delete(string $zone, Record $record): voidDomainsInterface interface
interface DomainsInterface extends ProviderInterface DomainsInterface.php:8
The domains the account holds, and each one's term.
DomainsInterface::domains()
public function domains(): arrayDomainsInterface::domain()
public function domain(string $domain): DomainInfoNameserversInterface interface
interface NameserversInterface extends ProviderInterface NameserversInterface.php:6
The name servers a registered domain delegates to.
NameserversInterface::nameservers()
public function nameservers(string $domain): array- Returns
host names, no trailing dot
NameserversInterface::setNameservers()
public function setNameservers(string $domain, array $nameservers): voidProviderFactory class
abstract class ProviderFactory implements ProviderFactoryInterface ProviderFactory.php:15
A provider's factory fills a Config - its name ("omnidns.factory_name"), its title ("omnidns.factory_title"), the options it needs ("omnidns.required_options") and the defaults of the others - then builds the provider from it.
Nothing here calls anything: a factory whose provider is reached over HTTP takes its client in its own constructor - the application's, a MockHttpClient in a test.
ProviderFactory::getName()
public function getName(): stringProviderFactory::create()
public function create(array $options = []): ProviderInterfaceProviderFactory::createConfig()
public function createConfig(array $options = []): ConfigProviderFactoryInterface interface
interface ProviderFactoryInterface ProviderFactoryInterface.php:6
Builds a provider from its options (a key, a token...).
ProviderFactoryInterface::getName()
public function getName(): stringThe name providers are configured with: "ovh", "cloudflare".
..
ProviderFactoryInterface::create()
public function create(array $options = []): ProviderInterfaceProviderInterface interface
interface ProviderInterface ProviderInterface.php:13
One provider where domains are registered or their DNS is served, configured: OVH, Gandi, Cloudflare, Scaleway... Its Capabilities say what it can be asked - is a domain free (AvailabilityInterface), register or renew it (RegistrarInterface), the domains the account holds and when they end (DomainsInterface), their name servers (NameserversInterface), the records of a zone (DnsInterface) - and whose terms apply.
ProviderInterface::getName()
public function getName(): stringThe factory's name: "ovh", "gandi", "cloudflare", "scaleway".
..
ProviderInterface::getTitle()
public function getTitle(): stringProviderInterface::capabilities()
public function capabilities(): CapabilitiesRegistrarInterface interface
interface RegistrarInterface extends ProviderInterface RegistrarInterface.php:13
Registering a domain and renewing it - orders that cost money: each provider says in its README whether the order is paid at once (the account's means of payment) or waits for a payment at Order::$paymentUrl.
RegistrarInterface::register()
public function register(string $domain, int $years = 1, ?Contact $owner = null): Order$ownerthe registrant; null: the account's default contact, where the provider has one
RegistrarInterface::renew()
public function renew(string $domain, int $years = 1): OrderRegistry class
final class Registry Registry.php:24
The application's domain and DNS providers by name, each built once from its factory and options:
$registry = new Registry([new OvhFactory(), new CloudflareFactory()], [ 'registrar' => ['factory' => 'ovh', 'options' => ['application_key' => '...', 'application_secret' => '...', 'consumer_key' => '...']], 'dns' => ['factory' => 'cloudflare', 'options' => ['token' => '...']], ]);
$registry->availability('registrar')->check('example.org')->available; $registry->dns('dns')->records('example.org', 'MX');
A typed getter gives the provider when it implements the interface and its capabilities() say it gives that as configured (Cloudflare lists domains only with an account_id): otherwise a NotSupportedException.
Registry::__construct()
public function __construct(iterable $factories, readonly array $config)Registry::get()
public function get(string $name): ProviderInterfaceRegistry::has()
public function has(string $name): boolRegistry::availability()
public function availability(string $name): AvailabilityInterfaceThe provider, as the availability of a domain.
Registry::registrar()
public function registrar(string $name): RegistrarInterfaceThe provider, as a registrar.
Registry::domains()
public function domains(string $name): DomainsInterfaceThe provider, as the account's domains.
Registry::nameservers()
public function nameservers(string $name): NameserversInterfaceThe provider, as a domain's name servers.
Registry::dns()
public function dns(string $name): DnsInterfaceThe provider, as a zone's records.
Registry::options()
public function options(string $name): array- Returns
the options a provider is configured with
Registry::names()
public function names(): array- Returns
the configured providers' names
Registry::factories()
public function factories(): array- Returns
the factories installed: what
factory:may name
Omnidns\Exception
InvalidArgumentException class
final class InvalidArgumentException extends InvalidArgumentException implements OmnidnsException InvalidArgumentException.php:6
A value no provider can take: a malformed domain name, a record type unknown, a duration of zero years.
InvalidConfigException class
final class InvalidConfigException extends InvalidArgumentException implements OmnidnsException InvalidConfigException.php:6
A provider asked for with options it cannot work with, or not configured at all.
NotSupportedException class
final class NotSupportedException extends LogicException implements OmnidnsException NotSupportedException.php:6
A provider asked for what it cannot give: a registration asked of a provider that only hosts DNS.
NotSupportedException::capability()
public static function capability(object $provider, string $name, string $capability): selfOmnidnsException interface
interface OmnidnsException extends Throwable OmnidnsException.php:6
Every exception omnidns throws.
ProviderException class
final class ProviderException extends RuntimeException implements OmnidnsException ProviderException.php:6
The provider answered, and not with what was asked: an error status, a domain not in the account, an order refused.
ProviderException::answered()
public static function answered(string $provider, string $what, int|string $status, int $code = 0): self$codethe HTTP status when the provider answered with one, as the exception's code
UnreachableException class
final class UnreachableException extends RuntimeException implements OmnidnsException UnreachableException.php:6
The provider could not be reached: a network error, a timeout.
Omnidns\Http
Json class
final class Json Json.php:15
A JSON request on the application's HTTP client, its failures turned into omnidns's exceptions (an empty answer is an empty array); and typed reads of what came back, for providers that walk an answer they do not control.
Json::request()
public static function request(HttpClientInterface $http, string $method, string $url, array $options, string $provider, string $what): array$optionsthe client's options (headers, json, query...)
- Returns
the decoded answer
Json::get()
public static function get(mixed $data, string|int ...$path): mixedThe value at a path of keys; null when any step is missing.
Json::string()
public static function string(mixed $data, string|int ...$path): ?stringA non-empty string at the path, or null.
Json::int()
public static function int(mixed $data, string|int ...$path): ?intJson::bool()
public static function bool(mixed $data, string|int ...$path): boolJson::list()
public static function list(mixed $data, string|int ...$path): array- Returns
the list at the path; empty when there is none
Json::date()
public static function date(mixed $data, string|int ...$path): ?\DateTimeImmutableA date at the path, or null.
Redaction class
final class Redaction Redaction.php:22
What a failed call may carry of its credentials, taken out before the failure leaves the package: an HTTP client's exception quotes the URL called (a key in its query, a password in its user part), and every exception's trace keeps the arguments of the calls under it (the request options, headers and query with the key) unless PHP runs with zend.exception_ignore_args.
copy() gives the previous exception to wrap instead of the client's own: the same class and code, its message with the key's parameters, the user part and every secret value replaced by ***, its trace without arguments, its own previous copied the same way. Properties of the client's class beyond those of \Exception are not copied (a Symfony HttpException's response, a PSR-18 exception's request: their URL holds the key). withoutArguments() takes the arguments out of the trace of the exception thrown in its place.
const MASK = '***'
Redaction::secrets()
public static function secrets(string $url, array $options = []): arrayThe secrets a request carries: the values of its query parameters, headers and body fields named as credentials (key, token, secret, password, signature, auth...), a bearer token, a basic password, the URL's user part.
$optionsthe HTTP client's options
Redaction::sensitive()
public static function sensitive(string $name): boolWhether a parameter, header or field of this name holds a credential.
Redaction::text()
public static function text(string $text, array $secrets = []): stringA text without credentials: in every address, the user part and the parameters named as credentials masked (api_key=***); then every secret given, raw or URL-encoded, masked wherever it stands.
Redaction::copy()
public static function copy(\Throwable $failure, array $secrets = []): \ThrowableA copy of a failure to wrap in its place: its class, code, file and line, its message through text(), its trace without arguments, its previous copied the same way.
Redaction::withoutArguments()
public static function withoutArguments(\Throwable $failure): \ThrowableThe failure given, the arguments out of its trace (and out of its previous ones'), as zend.exception_ignore_args would have left it.
Omnidns\Model
Availability class
final readonly class Availability Availability.php:10
Whether a domain can be registered, and at what price when the provider quotes one: the first year's (Gandi: before taxes; OVH: its "TOTAL"), and the renewal's when it says.
public string $domainpublic bool $availablepublic ?Money $pricepublic ?Money $renewalpublic ?string $reason
Availability::__construct()
public function __construct(public string $domain, public bool $available, public ?Money $price = null, public ?Money $renewal = null, public bool $premium = false, public ?string $reason = null)Availability::toArray()
public function toArray(): arrayContact class
final readonly class Contact Contact.php:10
The domain's owner (registrant), as a registry needs them - or a contact the provider already holds, named by its handle (an OVH /me/contact id, a Scaleway contact id): then the rest may stay empty.
const INDIVIDUAL = 'individual'const COMPANY = 'company'const ASSOCIATION = 'association'public string $firstNamepublic string $lastNamepublic string $emailpublic string $phonein the registries' form: +33.123456789
public string $streetpublic string $citypublic string $zippublic string $countryISO 3166-1 alpha-2: FR
public string $typepublic ?string $organizationpublic ?string $handle
Contact::__construct()
public function __construct(public string $firstName = '', public string $lastName = '', public string $email = '', public string $phone = '', public string $street = '', public string $city = '', public string $zip = '', public string $country = '', public string $type = self::INDIVIDUAL, public ?string $organization = null, public ?string $handle = null)$phonein the registries' form: +33.123456789
$countryISO 3166-1 alpha-2: FR
Contact::handle()
public static function handle(string $handle): selfContact::toArray()
public function toArray(): arrayDomainInfo class
final readonly class DomainInfo DomainInfo.php:10
A domain the account holds, as its registrar shows it: when it ends, whether it renews itself, its statuses, its name servers when the provider gives them in the same answer (null: ask NameserversInterface).
public string $namepublic ?\DateTimeImmutable $expiresAtpublic ?bool $autoRenewpublic array $statusthe registry's or the provider's statuses: "ok", "clientTransferProhibited"...
public ?array $nameserverspublic ?\DateTimeImmutable $createdAt
DomainInfo::__construct()
public function __construct(public string $name, public ?\DateTimeImmutable $expiresAt = null, public ?bool $autoRenew = null, public array $status = [], public ?array $nameservers = null, public ?\DateTimeImmutable $createdAt = null)$statusthe registry's or the provider's statuses: "ok", "clientTransferProhibited"...
DomainInfo::daysLeft()
public function daysLeft(?\DateTimeImmutable $now = null): ?intDays left before it ends (negative once it has); null when the provider does not say.
DomainInfo::toArray()
public function toArray(): arrayDomainName class
final class DomainName DomainName.php:8
A domain name as every provider is asked it: lower case, no trailing dot, labels a registry accepts.
DomainName::normalize()
public static function normalize(string $name): stringMoney class
final readonly class Money Money.php:8
A price in hundredths of its currency's unit (8.39 EUR: 839), and its ISO 4217 currency.
public string $currencypublic int $cents
Money::__construct()
public function __construct(public int $cents, string $currency)Money::fromDecimal()
public static function fromDecimal(string|int|float $amount, string $currency): selfFrom a decimal amount: "636.28", 636.28, 5.
Money::decimal()
public function decimal(): string"636.28"
Money::multiply()
public function multiply(float $factor): selfMoney::toArray()
public function toArray(): arrayOrder class
final readonly class Order Order.php:9
What a registration or a renewal left with the provider: its order or task, its state, its price and, when it waits for a payment, where to pay.
const REGISTER = 'register'const RENEW = 'renew'public string $domainpublic string $actionpublic string $statuspublic ?string $idpublic ?Money $pricepublic ?string $paymentUrlpublic int $years
Order::__construct()
public function __construct(public string $domain, public string $action, public string $status, public ?string $id = null, public ?Money $price = null, public ?string $paymentUrl = null, public int $years = 1)Order::toArray()
public function toArray(): arrayRecord class
final readonly class Record Record.php:16
One DNS record of a zone: its type, its name relative to the zone ("" for the apex, "www", "_dmarc"), its content (an address, a host, a text), its TTL (null: the zone's default) and, for MX, its priority apart. A provider that names records gives its id; one that groups them by name and type (Gandi's rrsets) gives none, and a record is then known by its name, type and content. Options are what one provider keeps besides (Cloudflare's "proxied"), handed back to it on an update.
const TYPES = ['A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'SRV', 'TXT']public string $typepublic string $namepublic string $contentpublic ?int $ttlpublic ?int $prioritypublic ?string $idpublic array $options
Record::__construct()
public function __construct(string $type, string $name, public string $content, public ?int $ttl = null, public ?int $priority = null, public ?string $id = null, public array $options = [])Record::normalizeName()
public static function normalizeName(string $name): stringA name relative to its zone as records hold it: lower case, no trailing dot, "" for the apex ("@").
Record::fromValue()
public static function fromValue(string $type, string $name, string $value, ?int $ttl = null, ?string $id = null, array $options = []): selfA record from a provider that writes an MX's priority in its value ("10 mx.example.org.").
Record::value()
public function value(): stringThe value as a zone file writes it: an MX's priority before its host.
Record::fqdn()
public function fqdn(string $zone): stringThe record's full name in a zone: "www.example.org", "example.org" for the apex.
Record::relative()
public static function relative(string $name, string $zone): stringA name a provider gives in full ("www.example.org"), relative to the zone ("www").
Record::sameAs()
public function sameAs(self $other): boolThe same record: the same id when both have one; else the same name, type and content (a host's trailing dot and a text's quotes aside).
Record::findIn()
public function findIn(iterable $records): ?selfThe one of these records that is the same as this one.
Record::withId()
public function withId(?string $id): selfRecord::toArray()
public function toArray(): arrayOmnidns\Testing
MemoryFactory class
final class MemoryFactory extends ProviderFactory MemoryFactory.php:17
MemoryProvider, from its options:
domains the domains held, and when each ends: ["example.org" => "2027-03-01"] taken the domains held by someone else price a year's price, as a Model\Money
Options
| Option | Default | |
|---|---|---|
domains | [] | |
taken | [] | |
price | null |
MemoryProvider class
final class MemoryProvider implements AvailabilityInterface, RegistrarInterface, DomainsInterface, NameserversInterface, DnsInterface MemoryProvider.php:25
A registrar and a DNS host in memory, every contract answered: for tests, demos and an application's fixtures. A domain registered is held for the years asked, served by ns1/ns2.memory.test, its zone empty.
MemoryProvider::__construct()
public function __construct(array $domains = [], readonly array $taken = [], readonly ?Money $price = null, readonly \DateTimeImmutable $now = new \DateTimeImmutable('2026-01-01'))$domainsthe domains held, and when each ends ("2027-03-01")
$takenthe domains held by someone else
MemoryProvider::getName()
public function getName(): stringMemoryProvider::getTitle()
public function getTitle(): stringMemoryProvider::capabilities()
public function capabilities(): CapabilitiesMemoryProvider::check()
public function check(string $domain): AvailabilityMemoryProvider::register()
public function register(string $domain, int $years = 1, ?Contact $owner = null): OrderMemoryProvider::renew()
public function renew(string $domain, int $years = 1): OrderMemoryProvider::domains()
public function domains(): arrayMemoryProvider::domain()
public function domain(string $domain): DomainInfoMemoryProvider::nameservers()
public function nameservers(string $domain): arrayMemoryProvider::setNameservers()
public function setNameservers(string $domain, array $nameservers): voidMemoryProvider::records()
public function records(string $zone, ?string $type = null, ?string $name = null): arrayMemoryProvider::add()
public function add(string $zone, Record $record): RecordMemoryProvider::update()
public function update(string $zone, Record $current, Record $new): RecordMemoryProvider::delete()
public function delete(string $zone, Record $record): void