sebastka / domeneshop-php
PHP library for working with the Domeneshop API
dev-master
2025-03-12 13:50 UTC
Requires
- php: >=8.2.0
- ext-curl: *
This package is auto-updated.
Last update: 2025-04-12 22:26:29 UTC
README
PHP library for working with the Domeneshop API.
Installation
composer require sebastka/domeneshop-php
Credentials
Use of this library requires Domeneshop API credentials.
See the Domeneshop API documentation for more information.
Examples
Operations on the first domain in your accout:
<?php require_once 'vendor/autoload.php'; $ds = new \Sebastka\Domeneshop\Client('YOUR_API_TOKEN', 'YOUR_API_SECRET_KEY'); $domain = $ds->domains->get()[0]; // Delete all _acme-challenge records $recordsToDelete = $domain->records->get(['type' => 'TXT', 'host' => '_acme-challenge']); foreach ($recordsToDelete as $record) $domain->records->delete($record); // Show all remaining records $allRecords = $domain->records->get(); foreach ($allRecords as $record) print_r($record->toArray()); // Add a new record: id, host, ttl, type, data, otherFields $new_record = new \Sebastka\Domeneshop\Record( NULL, '@', 3600, 'MX', 'mx.domain.tdl', [ 'priority' => 10 ] ); $domain->records->add($new_record); printf('Record ID: %d' . PHP_EOL, $new_record->getId()); // Update record $new_record->set('data', 'mx.domain.tld'); $new_record->set('priority', 20); $domain->records->update($new_record); // List HTTP forwards $forwards = $domain->forwards->get(); foreach ($forwards as $forward) print_r($forward->toArray()); ?>
To do
- Implement tests
- Implement class/resource abstraction