swentel/nostr-php
A PHP library for building Nostr clients and tools, with support for keys, events, relays, filters, and NIP implementations. It offers a clean, object-oriented API for publishing notes, subscribing to relays, and handling cryptographic signing in Laravel or plain PHP projects.
npub-based login or account-linking option (with NIP-05 handle verification) is a concrete, shippable auth path for crypto-native and censorship-sensitive user segments. This package lets you prototype it in days rather than scoping a protocol project.NostrPublisher, NostrIdentity) rather than calling the library directly from controllers. That decision preserves the option to swap to a JS/Go/Rust implementation later at low cost.Adopt when:
Look elsewhere when:
nostr-tools), Go, or Rust, with your Laravel app talking to it over HTTP/queue.strfry/nostream, not a helper library.nostr-tools (JS) is the right tool and this package adds nothing.To executives: This is a small, free (MIT), actively maintained PHP library that lets us test whether Nostr is a real distribution and identity channel for our product without a protocol project. It replaces what would otherwise be several weeks of specialized cryptography and networking work with an integration we can scope in a sprint. The cost is one engineer for roughly one sprint behind a feature flag, with a clear kill criterion: if relay publish success and engagement don't clear the bar, we delete the flag and keep the spike's findings. Downside is bounded and the learning is not — it also informs our broader "open protocol / data portability" positioning.
To engineering: The library covers the fiddly parts — event serialization and IDs, Schnorr signing, relay connections, key handling — so you're writing product code, not spec code. Two non-negotiables: wrap it behind our own interface so it never leaks into controllers, and pin the version, because a 70-star single-maintainer project is a dependency we contain, not one we trust implicitly. The likely end state for anything real-time is this library for signing and publishing plus a small worker for persistent relay subscriptions — plan the seam now so we don't rewrite later.
How can I help you explore Laravel packages today?