Skip to content
This repository was archived by the owner on Nov 4, 2025. It is now read-only.

Commit 2a0991d

Browse files
authored
Merge pull request #11 from DutchCodingCompany/v1
V1
2 parents 0760596 + c555df4 commit 2a0991d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+512
-460
lines changed

.php-cs-fixer.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@
170170
],
171171
],
172172
'trim_array_spaces' => true,
173+
'types_spaces' => [
174+
'space' => 'single',
175+
],
173176
'unary_operator_spaces' => true,
174177
'visibility_required' => [
175178
'elements' => [
@@ -188,12 +191,9 @@
188191

189192
$finder = Finder::create()
190193
->in([
191-
__DIR__.'/app',
192-
__DIR__.'/config',
193-
__DIR__.'/database',
194-
__DIR__.'/resources',
195-
__DIR__.'/routes',
196-
__DIR__.'/tests',
194+
__DIR__ . '/src',
195+
__DIR__ . '/config',
196+
__DIR__ . '/tests',
197197
])
198198
->name('*.php')
199199
->notName('*.blade.php')

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
All notable changes to `laravel-hetzner-dns-api` will be documented in this file.
44

5+
## 1.0.0 - 2023-11-07
6+
7+
### Changes
8+
- renamed `\DutchCodingCompany\HetznerDnsClient\RequestCollections\RecordCollection` to `\DutchCodingCompany\HetznerDnsClient\Resources\RecordResource`
9+
- renamed `\DutchCodingCompany\HetznerDnsClient\RequestCollections\ZoneCollection` to `\DutchCodingCompany\HetznerDnsClient\Resources\ZoneResource`
10+
- removed `bensampo/laravel-enum` package, `\DutchCodingCompany\HetznerDnsClient\Enums\RecordType` is now a native enum
11+
- dropped support for laravel 8.0
12+
- added support for laravel 10.0
13+
- removed `spatie/data-transfer-object`
14+
515
## 0.1.0 - 2022-06-23
616

717
Initial release

README.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
# An unofficial PHP SDK for the Hetzner DNS API.
33

44
[![Latest Version on Packagist](https://img.shields.io/packagist/v/dutchcodingcompany/laravel-hetzner-dns-api.svg?style=flat-square)](https://packagist.org/packages/dutchcodingcompany/laravel-hetzner-dns-api)
5-
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/dutchcodingcompany/laravel-hetzner-dns-api/run-tests?label=tests)](https://github.com/dutchcodingcompany/laravel-hetzner-dns-api/actions?query=workflow%3Arun-tests+branch%3Amain)
6-
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/dutchcodingcompany/laravel-hetzner-dns-api/Check%20&%20fix%20styling?label=code%20style)](https://github.com/dutchcodingcompany/laravel-hetzner-dns-api/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
75
[![Total Downloads](https://img.shields.io/packagist/dt/dutchcodingcompany/laravel-hetzner-dns-api.svg?style=flat-square)](https://packagist.org/packages/dutchcodingcompany/laravel-hetzner-dns-api)
86

97
This PHP/Laravel client around the [Hetzner DNS API](https://dns.hetzner.com/api-docs) support:
@@ -21,24 +19,36 @@ You can install the package via composer:
2119
composer require dutchcodingcompany/laravel-hetzner-dns-api
2220
```
2321

22+
Set your hetzner dns api token in your .env file:
23+
```env
24+
HETZNER_DNS_API_TOKEN=hetzner-dns-token-here
25+
```
26+
27+
## Configuration (optional)
2428
You can publish the config file with:
2529

2630
```bash
27-
php artisan vendor:publish --tag="laravel-hetzner-dns-api-config"
31+
php artisan vendor:publish --tag="hetzner-dns-api-config"
2832
```
2933

30-
This is the contents of the published config file:
31-
32-
```php
33-
return [
34-
'api_token' => env('HETZNER_DNS_API_TOKEN')
35-
];
36-
```
34+
This is the contents of the published config file [can be found here](config/hetzner-dns.php).
3735

3836
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`
3937
```php
38+
<?php
39+
40+
namespace App\Providers;
41+
42+
use Illuminate\Support\ServiceProvider;
4043
use DutchCodingCompany\HetznerDnsClient\HetznerDnsClient;
41-
HetznerDnsClient::resolveApiTokenUsing(fn () => 'your-token');
44+
45+
class AppServiceProvider extends ServiceProvider
46+
{
47+
public function boot(): void
48+
{
49+
HetznerDnsClient::resolveApiTokenUsing(fn () => 'your-token');
50+
}
51+
}
4252
```
4353

4454
## Usage
@@ -49,18 +59,9 @@ $records = HetznerDnsClient::records()->all();
4959
```
5060

5161
## ToDo
52-
- Caching
62+
- add caching
5363
- ...
5464

55-
[//]: # (## Testing)
56-
57-
[//]: # ()
58-
[//]: # (```bash)
59-
60-
[//]: # (composer test)
61-
62-
[//]: # (```)
63-
6465
## Changelog
6566

6667
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

composer.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,18 @@
1313
"name": "Niek Brekelmans",
1414
"email": "[email protected]",
1515
"role": "Developer"
16+
},
17+
{
18+
"name": "Tom Janssen",
19+
"email": "[email protected]",
20+
"role": "Developer"
1621
}
1722
],
1823
"require": {
19-
"php": "^8.0",
20-
"bensampo/laravel-enum": "^4.2|^5.3",
21-
"illuminate/contracts": "^8.0|^9.0",
22-
"sammyjo20/saloon-laravel": "^1.4",
23-
"spatie/data-transfer-object": "^3.8",
24-
"spatie/laravel-package-tools": "^1.9.2"
24+
"php": "^8.1",
25+
"illuminate/contracts": "^9.0 | ^10.0",
26+
"saloonphp/saloon": "^3.0",
27+
"spatie/laravel-package-tools": "^1.16.1"
2528
},
2629
"require-dev": {
2730
"friendsofphp/php-cs-fixer": "^3.8",

config/hetzner-dns.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
// config for DutchCodingCompany/HetznerDnsClient
34
return [
45
'api_token' => env('HETZNER_DNS_API_TOKEN'),
@@ -7,5 +8,5 @@
78
env('HETZNER_NAMESERVER_1', 'hydrogen.ns.hetzner.com.'),
89
env('HETZNER_NAMESERVER_2', 'oxygen.ns.hetzner.com.'),
910
env('HETZNER_NAMESERVER_3', 'helium.ns.hetzner.de.'),
10-
]
11+
],
1112
];

phpstan-baseline.neon

Whitespace-only changes.

phpstan.neon.dist

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
includes:
2-
- phpstan-baseline.neon
3-
41
parameters:
5-
level: 4
2+
level: 8
63
paths:
74
- src
85
- config
9-
- database
106
tmpDir: build/phpstan
117
checkOctaneCompatibility: true
128
checkModelProperties: true

src/Enums/RecordType.php

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,20 @@
22

33
namespace DutchCodingCompany\HetznerDnsClient\Enums;
44

5-
use BenSampo\Enum\Enum;
6-
7-
/**
8-
* @method static static A()
9-
* @method static static AAAA()
10-
* @method static static NS()
11-
* @method static static MX()
12-
* @method static static CNAME()
13-
* @method static static RP()
14-
* @method static static TXT()
15-
* @method static static SOA()
16-
* @method static static HINFO()
17-
* @method static static SRV()
18-
* @method static static DANE()
19-
* @method static static TLSA()
20-
* @method static static DS()
21-
* @method static static CAA()
22-
*/
23-
final class RecordType extends Enum
5+
enum RecordType: string
246
{
25-
public const A = 'A';
26-
public const AAAA = 'AAAA';
27-
public const NS = 'NS';
28-
public const MX = 'MX';
29-
public const CNAME = 'CNAME';
30-
public const RP = 'RP';
31-
public const TXT = 'TXT';
32-
public const SOA = 'SOA';
33-
public const HINFO = 'HINFO';
34-
public const SRV = 'SRV';
35-
public const DANE = 'DANE';
36-
public const TLSA = 'TLSA';
37-
public const DS = 'DS';
38-
public const CAA = 'CAA';
7+
case A = 'A';
8+
case AAAA = 'AAAA';
9+
case NS = 'NS';
10+
case MX = 'MX';
11+
case CNAME = 'CNAME';
12+
case RP = 'RP';
13+
case TXT = 'TXT';
14+
case SOA = 'SOA';
15+
case HINFO = 'HINFO';
16+
case SRV = 'SRV';
17+
case DANE = 'DANE';
18+
case TLSA = 'TLSA';
19+
case DS = 'DS';
20+
case CAA = 'CAA';
3921
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace DutchCodingCompany\HetznerDnsClient\Exceptions;
4+
5+
interface HetznerDnsApiException
6+
{
7+
//
8+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace DutchCodingCompany\HetznerDnsClient\Exceptions;
4+
5+
use InvalidArgumentException as BaseInvalidArgumentException;
6+
7+
class InvalidArgumentException extends BaseInvalidArgumentException implements HetznerDnsApiException
8+
{
9+
//
10+
}

0 commit comments

Comments
 (0)