PHPackages                             balfour/domains-coza-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. balfour/domains-coza-api

AbandonedArchivedLibrary[API Development](/categories/api)

balfour/domains-coza-api
========================

An integration with the domains.co.za reseller API

0.0.1-alpha(6y ago)0161MITPHPPHP &gt;=7.3.0

Since Feb 24Pushed 6y ago6 watchersCompare

[ Source](https://github.com/balfour-group/domains-coza-api)[ Packagist](https://packagist.org/packages/balfour/domains-coza-api)[ RSS](/packages/balfour-domains-coza-api/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

domains-coza-api
================

[](#domains-coza-api)

An integration with the domains.co.za reseller API.

*This library is in early release and is pending unit tests.*

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
    - [Creating a Client](#creating-a-client)
    - [Register Domain](#register-domain)
    - [Check Domain Availability](#check-domain-availability)
    - [Delete Domain](#delete-domain)
    - [Update Domain Registrant](#update-domain-registrant)
    - [Renew Domain](#renew-domain)
    - [Transfer Domain](#transfer-domain)
    - [Suspend Domain](#suspend-domain)
    - [Unsuspend Domain](#unsuspend-domain)
    - [Check Multiple TLD Availability](#check-multiple-tld-availability)
    - [Retrieve Domain Info](#retrieve-domain-info)
    - [Update Nameservers](#update-nameservers)
    - [Retrieve Domain EPP Auth Key](#retrieve-domain-epp-auth-key)
    - [Cancel Domain Update](#cancel-domain-update)
    - [Cancel Domain Delete](#cancel-domain-delete)
    - [Set Domain AutoRenew](#set-domain-autorenew)
    - [Check Domain Transfer](#check-domain-transfer)
    - [Cancel Domain Transfer](#cancel-domain-transfer)
    - [Retrieve Domain Totals Summary](#retrieve-domain-totals-summary)
    - [List Domains](#list-domains)
    - [Search Domains](#search-domains)
    - [Retrieve DNS Records](#retrieve-dns-records)
    - [Update DNS Records](#update-dns-records)

Installation
------------

[](#installation)

```
composer require balfour/domains-coza-api
```

Usage
-----

[](#usage)

Please see [https://www.domains.co.za/api/latest\_api.pdf](https://www.domains.co.za/api/latest_api.pdf) for full API documentation.

### Creating a Client

[](#creating-a-client)

```
use GuzzleHttp\Client as Guzzle;
use Balfour\DomainsResellerAPI\Client;

$guzzle = new Guzzle();
$client = new Client($guzzle, 'your-api-key');
```

### Register Domain

[](#register-domain)

```
$response = $client->registerDomain(
    'mydomain.co.za',
    'Balfour Group (Pty) Ltd',
    'dns-admin@moo.com',
    '+27.211111111',
    'My Address Line 1',
    'My Optional Address Line 2',
    '8001',
    'ZA',
    'Balfour Group (Pty) Ltd',
    'Cape Town',
    'Western Cape',
    1, // years - max of 1 year for co.za domains
    true, // use managed nameservers
    [],
    'TEST1' // optional external ref
);

// using custom nameservers
$response = $client->registerDomain(
    'mydomain.co.za',
    'Balfour Group (Pty) Ltd',
    'dns-admin@moo.com',
    '+27.211111111',
    'My Address Line 1',
    'My Optional Address Line 2',
    '8001',
    'ZA',
    'Balfour Group (Pty) Ltd',
    'Cape Town',
    'Western Cape',
    1, // years - max of 1 year for co.za domains
    false, // not using managed nameservers
    [
        'ns1.foo.bar',
        'ns2.foo.bar',
        'ns3.foo.bar',
        'ns4.foo.bar',
        'ns5.foo.bar',
    ],
    'TEST1' // optional external ref
);

// you can also register a domain using an implementation of RegistrantInterface
// eg: assuming $registrant is an implementation
$response = $client->registerDomainForRegistrant('mydomain.co.za', $registrant);
```

### Check Domain Availability

[](#check-domain-availability)

```
$isAvailable = $client->isDomainAvailable('mydomain.co.za');
```

### Delete Domain

[](#delete-domain)

```
$response = $client->deleteDomain('mydomain.co.za');
```

### Update Domain Registrant

[](#update-domain-registrant)

```
$response = $client->updateDomainRegistrant(
    'mydomain.co.za',
    'Balfour Group (Pty) Ltd',
    'dns-admin@moo.com',
    '+27.211111111',
    'My Address Line 1',
    'My Optional Address Line 2',
    '8001',
    'ZA',
    'Balfour Group (Pty) Ltd',
    'Cape Town',
    'Western Cape'
);

// you can also use an implementation of RegistrantInterface
$client->updateDomainRegistrantFromRegistrant('mydomain.co.za', $registrant);
```

### Renew Domain

[](#renew-domain)

```
$response = $client->renewDomain('mydomain.co.za', 1);
```

### Transfer Domain

[](#transfer-domain)

```
$response = $client->transferDomain(
    'mydomain.co.za',
    'Balfour Group (Pty) Ltd',
    'dns-admin@moo.com',
    '+27.211111111',
    'My Address Line 1',
    'My Optional Address Line 2',
    '8001',
    'ZA',
    'Balfour Group (Pty) Ltd',
    'Cape Town',
    'Western Cape',
    null, // epp key (if required for tld)
    'keep', // possible values are keep, managed or custom
    [], // cusotm nameservers - only used if dns type is set to 'custom'
    'TEST1' // optional external ref
);

// you can also use an implementation of RegistrantInterface
$client->transferDomainForRegistrant(
    'mydomain.co.za',
    $registrant,
    null, // epp key (if required for tld)
    'keep', // possible values are keep, managed or custom
    [], // cusotm nameservers - only used if dns type is set to 'custom'
    'TEST1' // optional external ref
);
```

### Suspend Domain

[](#suspend-domain)

```
$response = $client->suspendDomain('mydomain.co.za');
```

### Unsuspend Domain

[](#unsuspend-domain)

```
$response = $client->unsuspendDomain('mydomain.co.za');
```

### Check Multiple TLD Availability

[](#check-multiple-tld-availability)

```
$response = $client->checkMultipleTLDAvailability('mydomain');
var_dump($response->getTLDs());
var_dump($response->getAvailableTLDs());
var_dump($response->getAvailableTLDs());
var_dump($response->getTakenTLDs());
var_dump($response->getTLD('co.za'));
var_dump($response->isTLDAvailable('co.za'));
```

### Retrieve Domain Info

[](#retrieve-domain-info)

```
$response = $client->getDomain('mydomain.co.za');

$contacts = $response->getContacts();
var_dump($contacts);

$registrant = $response->getRegistrant();
var_dump($registrant->getContactNumber());
var_dump($registrant->hasPendingUpdate());
var_dump($registrant->getPendingUpdate()->getExpectedChangeDate());

var_dump($response->getNameservers());

var_dump($response->getCreationDate());
```

### Update Nameservers

[](#update-nameservers)

```
// use managed dns
$response = $client->updateNameservers('mydomain.co.za', true);

// use custom nameservers
$response = $client->updateNameservers(
    'mydomain.co.za',
    false,
    [
        'ns1.foo.bar',
        'ns2.foo.bar',
        'ns3.foo.bar',
        'ns4.foo.bar',
        'ns5.foo.bar',
    ]
);
```

### Retrieve Domain EPP Auth Key

[](#retrieve-domain-epp-auth-key)

```
$response = $client->getDomainEPPAuthKey('mydomain.co.za');
var_dump($response->getEPPKey());
```

### Cancel Domain Update

[](#cancel-domain-update)

```
$response = $client->cancelDomainUpdate('mydomain.co.za');
```

### Cancel Domain Delete

[](#cancel-domain-delete)

```
$response = $client->cancelDomainDelete('mydomain.co.za');
```

### Set Domain AutoRenew

[](#set-domain-autorenew)

```
$response = $client->setDomainAutoRenew('mydomain.co.za', true);
$response = $client->setDomainAutoRenew('mydomain.co.za', false);
$response = $client->enableDomainAutoRenew('mydomain.co.za');
$response = $client->disableDomainAutoRenew('mydomain.co.za');
```

### Check Domain Transfer

[](#check-domain-transfer)

```
$response = $client->checkDomainTransfer('mydomain.co.za');
var_dump($response->getRequestDate());
var_dump($response->getStatus());
var_dump($response->isComplete());
```

### Cancel Domain Transfer

[](#cancel-domain-transfer)

```
$response = $client->cancelDomainTransfer('mydomain.co.za');
```

### Retrieve Domain Totals Summary

[](#retrieve-domain-totals-summary)

```
$response = $client->getDomainTotalsSummary();
var_dump($response->getSummary());
var_dump($response->getTotalTransfersIn());
```

### List Domains

[](#list-domains)

```
$response = $client->getDomains();

// using limit and offset
$response = $client->getDomains(15, 0);

// sorting results
$response = $client->getDomains(15, 0, 'dateRegistered');
$response = $client->getDomains(15, 0, 'dateRegistered', 'descending');

// filtering results
$response = $client->getDomains(15, 0, 'name', 'ascending', 'expiring90');

var_dump($response->getTotal());

foreach ($response->getDomains() as $domain) {
    var_dump($domain->getName());
    var_dump($domain->isPremiumDNSEnabled());
    var_dump($domain->getCreationDate());
    var_dump($domain->getNameservers());
}
```

### Search Domains

[](#search-domains)

```
$response = $client->searchDomains('mydomain');

foreach ($response->getDomains() as $domain) {
    var_dump($domain->getName());
    var_dump($domain->getStatus());
}
```

### Retrieve DNS Records

[](#retrieve-dns-records)

```
use Badcow\DNS\AlignedBuilder;

$response = $client->getDNSRecords('mydomain.co.za');

var_dump($response->toArray());

foreach ($response->getRecords() as $record) {
    var_dump($record->getType());
    var_dump($record->getName());
    var_dump($record->getContent());
    var_dump($record->getPriority()); // only applicable to MX records
    var_dump($record->getTTL());
}

// filter by type of record
$records = $response->getRecordsByType('MX');

// the records can be formatted as a zone file
$zone = $response->getZone();
echo AlignedBuilder::build($zone);
```

### Update DNS Records

[](#update-dns-records)

**Please Note:**

1. The API only supports A, AAAA, CNAME, MX and TXT records.
2. The zone file is replaced in full upon each update.

```
use Badcow\DNS\Rdata\Factory;
use Badcow\DNS\ResourceRecord;

// this example assumes no existing records
$a = new ResourceRecord;
$a->setName('sub.domain');
$a->setTtl(3600);
$a->setRdata(Factory::A('127.0.0.1'));

$mx = new ResourceRecord();
$mx->setName('@');
$mx->setRdata(Factory::Mx(10, 'mail-gw1.example.net.'));

$response = $client->updateDNSRecords('mydomain.co.za', [$a, $mx]);

// here, we first fetch the existing records, add a new record to the zone, then update passing in the zone
$response = $client->getDNSRecords('mydomain.co.za');
$zone = $response->getZone();

$a = new ResourceRecord;
$a->setName('sub.domain');
$a->setTtl(3600);
$a->setRdata(Factory::A('127.0.0.1'));

$zone->addResourceRecord($a);

// notice how we're just passing in a
$client->updateDNSRecordsFromZone($zone);

// you can also update the records from a local zone file
$client->updateDNSRecordsFromZoneFile('mydomain.co.za', '/path/to/zonefile');
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2268d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/054093c4138d9bea138f6226b632f8f7ad0adb516562480f7f77868d481e75f0?d=identicon)[balfourgroup](/maintainers/balfourgroup)

---

Top Contributors

[![matthewgoslett](https://avatars.githubusercontent.com/u/1571743?v=4)](https://github.com/matthewgoslett "matthewgoslett (8 commits)")

### Embed Badge

![Health badge](/badges/balfour-domains-coza-api/health.svg)

```
[![Health](https://phpackages.com/badges/balfour-domains-coza-api/health.svg)](https://phpackages.com/packages/balfour-domains-coza-api)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.2M720](/packages/statamic-cms)[ashallendesign/laravel-exchange-rates

A wrapper package for interacting with the exchangeratesapi.io API.

485677.8k](/packages/ashallendesign-laravel-exchange-rates)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1221.1k](/packages/codebar-ag-laravel-docuware)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
