Search by

omnidns / cloudflare

GlitchArt

Omnidns's Cloudflare, under any PHP host: the records of a zone (over cloudflare/sdk, proxying kept), and the domains Cloudflare Registrar holds for an account with their terms - an API token.

v1.0.0 2026-11-13 08:47 UTC

This package is auto-updated.

Last update: 2026-11-13 13:28:41 UTC


README

Cloudflare for omnisense/omnidns, under any PHP host: the records of a zone Cloudflare serves, and the domains Cloudflare Registrar holds for an account with their terms.

composer require omnisense/omnidns omnidns/cloudflare

It needs a Cloudflare account and an API token (the token option); a registration or a renewal is paid for. Its tests run on recorded answers and need none; omnidns's README has a first call on a recorded client.

use Omnidns\Cloudflare\CloudflareFactory;
use Omnidns\Model\Record;
use Omnidns\Registry;

$registry = new Registry([new CloudflareFactory()], [
    'cloudflare' => ['factory' => 'cloudflare', 'options' => ['token' => $apiToken, 'account_id' => $accountId]],
]);
$registry->dns('cloudflare')->add('example.org', new Record('CNAME', 'www', 'example.org', options: ['proxied' => true]));

Options: token (required: an API token with Zone:Read and DNS:Edit, and Account Registrar:Read for the domains), account_id (the Registrar's domains; empty: no DomainsInterface), base_uri.

Reuse: it wraps cloudflare/sdk (2.0, June 2026; community-maintained, a subset of the API, framework-free): its Zones and DNS endpoints for the records, its adapter for the Registrar's two reads it does not cover. The SDK sends with Guzzle; CloudflareFactory takes another Cloudflare\API\Adapter\Adapter.

  • Records: 100 a page; TTL 1 ("auto") read as null; proxied kept in Record::$options and left as it was by an update unless the new record says otherwise; a record added is never proxied unless asked. SRV and CAA are sent as Cloudflare's structured data, from their zone-file value (10 5 5060 sip.example.org, 0 issue "letsencrypt.org"). Types outside omnidns's (HTTPS, SVCB...) are left out.
  • Domains: accounts/{id}/registrar/domains - term, auto-renewal, statuses.
  • Not here: availability, registration, renewal and name servers - Cloudflare's API has no call for the first three, and a zone's name servers are Cloudflare's own (the registry's availability(), registrar(), nameservers() refuse it).

Terms

Cloudflare's terms and its API's rate limits (1,200 calls per five minutes per user).

Usage policy

policy.json (omnisense/contracts' schema, read on 2026-11-10, CloudflareProvider::POLICY): 1,200 requests every 5 minutes (per user, across the dashboard and every token) and 200 a second, counted here for the whole application; past the first, Cloudflare refuses every call for five minutes. Rights unknown; the agreement forbids circumventing usage limits and selling access to the Services. A key is required. Through omnidns's registry each call is checked against it and counted, a 429 and its Retry-After hold every next call (UsageLimitReachedException); a site may tighten it (policy), never loosen it. See the core's usage policies.

Verified, and not

  • Verified on recorded answers, written from Cloudflare's API v4 reference (not captured), as cloudflare/sdk makes the calls through its adapter: the records page after page, filtered, the zone's id asked once, an addition (MX, CAA as data), an update keeping the proxy, a deletion by id, a record or a zone Cloudflare does not hold, an error's message, the Registrar's domains; BareTest; PHPStan at the highest level.
  • Not verified live: no Cloudflare token at hand.

Responsibility

This package is an independent, unofficial client: it is not affiliated with, endorsed by or sponsored by Cloudflare, Inc.. It reaches their service on behalf of whoever runs it; its MIT licence covers this package's code only and grants no right to the service or its data. Whoever installs and runs it is responsible for complying with Cloudflare's terms, for paying the orders it places, for obtaining what they require (an account, a key, a contract), and for any use made of what it returns. The authors publish it free of charge and accept no liability for how it is used (see LICENSE).

Licence

MIT.