PHPackages                             nais-standard/sdk - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. nais-standard/sdk

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

nais-standard/sdk
=================

PHP SDK for the Network Agent Identity Standard (NAIS). Resolve, validate, and verify the signatures of NAIS-compliant agent cards.

1.0.1(1mo ago)01↓50%MITPHPPHP &gt;=7.4

Since Jun 23Pushed 1mo agoCompare

[ Source](https://github.com/nais-standard/nais-php)[ Packagist](https://packagist.org/packages/nais-standard/sdk)[ Docs](https://nais.id)[ RSS](/packages/nais-standard-sdk/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependenciesVersions (3)Used By (0)

nais-standard/sdk
=================

[](#nais-standardsdk)

PHP SDK for the [Network Agent Identity Standard (NAIS)](https://nais.id).

Resolve and validate NAIS-compliant agent domains. Requires PHP 7.4+ and uses only built-in facilities — `dns_get_record`, `ext-curl`, and `ext-sodium` — with no third-party Composer dependencies. The SDK resolves directly: it reads the `_agent.` DNS TXT record, fetches the signed card over HTTPS (HTTPS-only, no cross-host redirects, 1 MiB cap), and verifies the card's mandatory Ed25519 signature against the DNS `k=` key. Server-side only — browsers cannot perform DNS lookups.

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

[](#installation)

```
composer require nais-standard/sdk
```

Usage
-----

[](#usage)

### resolve(string $domain): array

[](#resolvestring-domain-array)

Resolves a domain directly via DNS and HTTPS and returns a structured result array:

- `ok` — overall success flag.
- `domain` — the normalized domain.
- `agent_host` — the host serving the card.
- `dns` — `['records', 'parsed']`, where `parsed` exposes `v`, `manifest`, and `k`.
- `manifest_url` — the URL the card was fetched from.
- `card` — the decoded `agent.json`.
- `signature` — `['present', 'verified', 'kid', 'alg', 'reason']`.
- `validation` — `['valid', 'errors', 'warnings']`.

```
