Note: This library is under active development as I expand it to cover Cloudflare API. Consider the public API of this package a little unstable as I work towards a v1.0. See Coverage.

DNS Records

View, create, update your zones DNS Records on Cloudflare.

Cloudflare API docs

Scan

Scan DNS record. Scan for common DNS records on your domain and automatically add them to your zone. Useful if you haven't updated your nameservers yet.

php
$response = $client->zones()->dns()->scan('zone_id');

List

List, search, sort, and filter a zones' DNS record.

php
$response = $client->zones()->dns()->list('zone_id');

Create

Create a new DNS record for a zone.

php
$response = $client->zones()->dns()->create('zone_id', [
    'name' => '@'
    'content' => '127.0.0.1',
    'proxied' => true,
    'type' => 'A'
]);

Export

Export DNS record as BIND config.

php
$response = $client->zones()->dns()->export('zone_id');

file_put_contents('./test.txt', $response->body());

Import

Import DNS record as BIND config.

php
$contents = file_put_contents('./test.txt');

$response = $client->zones()->dns()->import('zone_id', $contents);

Details

DNS record Details.

php
$response = $client->zones()->dns()->details('zone_id', 'dns_record_id');

Update

Update an existing DNS record.

php
$response = $client->zones()->dns()->update('zone_id', 'dns_record_id', [
    'name' => '@'
    'content' => '127.0.0.1',
    'proxied' => true,
    'type' => 'A'
]);

Overwrite

Overwrite an existing DNS record.

php
$response = $client->zones()->dns()->overwrite('zone_id', 'dns_record_id', [
    'name' => '@'
    'content' => '127.0.0.1',
    'proxied' => true,
    'type' => 'A'
]);

Delete

Delete DNS record.

php
$response = $client->zones()->dns()->delete('zone_id', 'dns_record_id');