nostriphant / client
Simple Nostr client
Installs: 162
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:project
pkg:composer/nostriphant/client
Requires
- php: ^8.4
- amphp/websocket-client: ^2.0
- nostriphant/functional: ^2.2
- nostriphant/nip-01: ^2.0
Requires (Dev)
- mockery/mockery: ^1.6
- pestphp/pest: ^4.0
README
Simple nostr php client
<?php use nostriphant\NIP01\Message; use nostriphant\Client\Client; $client = Client::connectToUrl("wss://nos.lol"); $listen = $client(function(\nostriphant\NIP01\Transmission $send) { // connection has been established, start communicating here $send(Message::event(new \nostriphant\NIP59\Rumor(time(), 'pubkey', 1, 'Hello World!', []))); }); listen(function(\nostriphant\NIP01\Message $message, callable $stop) { // code to handle incoming messages $stop(); // stops listening }); $listen(fn(int $signal) => printf("Received signal %d, stopping client", $signal));