dutchcodingcompany / laravel-hetzner-dns-api
An unofficial PHP SDK for the Hetzner DNS API.
Requires
- php: ^8.1
- illuminate/contracts: ^9.0 | ^10.0
- saloonphp/saloon: ^3.0
- spatie/laravel-package-tools: ^1.16.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.8
- nunomaduro/collision: ^6.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^7.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- spatie/laravel-ray: ^1.26
README
This PHP/Laravel client around the Hetzner DNS API support:
- Zones
- Records
This SDK is based on Saloon, a Laravel / PHP package that helps write API integrations and SDKs.
Installation
You can install the package via composer:
composer require dutchcodingcompany/laravel-hetzner-dns-api
Set your hetzner dns api token in your .env file:
HETZNER_DNS_API_TOKEN=hetzner-dns-token-here
Configuration (optional)
You can publish the config file with:
php artisan vendor:publish --tag="hetzner-dns-api-config"
This is the contents of the published config file can be found here.
If you would like to store the API Token outside of the config (e.g. encrypted in the database), you can override the resolver in the boot
method of the AppServiceProvider
<?php namespace App\Providers; use Illuminate\Support\ServiceProvider; use DutchCodingCompany\HetznerDnsClient\HetznerDnsClient; class AppServiceProvider extends ServiceProvider { public function boot(): void { HetznerDnsClient::resolveApiTokenUsing(fn () => 'your-token'); } }
Usage
$records = HetznerDnsClient::records()->all(); // resolves to a Records DTO
ToDo
- add caching
- ...
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.