-
Notifications
You must be signed in to change notification settings - Fork 0
Home
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.
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.
-
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
Nansenfacade so you can writeNansen::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.
Built by Igor Sazonov. Released under the MIT License.