decent-newsroom / nostr-client-bundle
Reusable Symfony bundle wrapping innis/nostr-client (AMPHP-based async Nostr relay client) for DI-friendly relay connections, subscriptions and publishing
Package info
github.com/decent-newsroom/nostr-client-bundle
Type:symfony-bundle
pkg:composer/decent-newsroom/nostr-client-bundle
dev-main
2026-08-20 18:01 UTC
Requires
- php: ^8.3
- innis/nostr-client: ^0.1.7
- innis/nostr-core: ^0.3.17
- psr/log: ^3.0
- symfony/framework-bundle: ^7.4
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2026-08-20 18:01:46 UTC
README
Reusable Symfony integration wrapping innis/nostr-client,
an AMPHP-based async WebSocket client for the Nostr protocol.
The bundle wires the vendor library's static factory into DI-managed services so the host application can inject a ready-to-use relay client instead of constructing it by hand:
Innis\Nostr\Client\Application\Port\NostrClientInterface— connect, subscribe, publish, health-check against one or more relays.Innis\Nostr\Client\Domain\Service\RelayHealthCheckerInterface— standalone relay health checks without an active connection.Innis\Nostr\Client\Domain\ValueObject\ConnectionConfig— the default connection configuration derived from bundle config.DecentNewsroom\NostrClientBundle\Contract\NostrClientFactoryInterface— a stable, bundle-owned seam for creating clients/health-checkers, so call sites don't depend on the vendor factory directly.
Documentation
Configuration
# config/packages/nostr_client.yaml nostr_client: connection_timeout_seconds: 10 auto_reconnect: true reconnect_initial_delay_ms: 500 reconnect_max_delay_ms: 60000 reconnect_max_attempts: 0 user_agent: null
Usage
use Innis\Nostr\Client\Application\Port\NostrClientInterface; use Innis\Nostr\Core\Domain\Entity\Filter; use Innis\Nostr\Core\Domain\ValueObject\Protocol\RelayUrl; final class ExampleService { public function __construct(private readonly NostrClientInterface $client) {} public function fetchRecent(string $relayUrl): void { $relay = RelayUrl::fromString($relayUrl); $this->client->connect($relay); // ...subscribe/publish as needed, see innis/nostr-client README. $this->client->close(); } }