Skip to content
Igor Sazonov edited this page Jul 15, 2026 · 1 revision

Nansen PHP Documentation

Welcome to the official documentation for Nansen PHP!

This library is a framework-agnostic PHP 8.1+ client for the Nansen AI API. It provides a fluent, chainable interface, typed DTO responses, automatic rate-limit handling with retries, PSR-18 HTTP client support, and a clear exception hierarchy for reliable, expressive access to smart-money crypto data. It also comes with first-class Laravel 10–13 support out of the box.

Why Nansen PHP?

Talking to the Nansen API by hand gets old fast — you end up copy-pasting the same cURL boilerplate, decoding JSON, and reinventing retry logic every time. This library wraps all of that behind a fluent interface, so a request reads more or less like a sentence.

Key Features

  • No framework required. The core is plain PHP 8.1+, so you can drop it into anything.

  • Laravel, if you want it. Auto-discovered service provider, a publishable config file, and a Nansen facade so you can write Nansen::smartMoney()->netflows().

  • Bring your own HTTP client. Guzzle is used by default, but anything PSR-18 works — just inject it.

  • A fluent API that actually reads well: ->smartMoney()->netflows()->chains(['ethereum'])->limit(10)->get().

  • Typed responses, not loose arrays. Everything comes back as a DTO, and lists are real collections you can count(), loop over, and index into.

  • You never lose data. Each DTO keeps the untouched API response in ->raw, so if Nansen adds a field tomorrow, you can still read it today.

  • Rate limits handled for you. When the API returns a 429, the client backs off and retries automatically, honoring Retry-After. There's a clear exception hierarchy (ApiException, RateLimitException, UnauthorizedException, NotFoundException) for everything else.

Navigation


Built by Igor Sazonov. Released under the MIT License.

Clone this wiki locally