Worked correctly and gave me this
Discussion
But it also gave me this
PHP Fatal error: Uncaught TypeError: json_decode(): Argument #1 ($json) must be of type string, WebSocket\Message\Text given in /home/.../vendor/swentel/nostr-php/src/Relay/Relay.php:90
Stack trace:
#0 /home/.../vendor/swentel/nostr-php/src/Relay/Relay.php(90): json_decode()
#1 /home/.../create30041Event.php(28): swentel\nostr\Relay\Relay->send()
#2 {main}
thrown in /home/.../vendor/swentel/nostr-php/src/Relay/Relay.php on line 90
Found it, fixing it and will push a new release asap with the fix.
Might want to see if the tests aren't broken, as well. They seem to be having trouble resolving the Key namespace.
Here's what happened with the CLI.
$ bin/nostr-php --content "Test of CLI" --key /home/.../nostr-private.key --relay wss://theforest.nostr1.com
PHP Fatal error: Uncaught Error: Typed property swentel\nostr\Relay\Relay::$payload must not be accessed before initialization in /home/.../nostr-php/src/Relay/Relay.php:87
Stack trace:
#0 /home/.../nostr-php/src/Application/Client.php(85): swentel\nostr\Relay\Relay->send()
#1 /home/.../nostr-php/bin/nostr-php(47): swentel\nostr\Application\Client->run()
#2 {main}
thrown in /home/.../nostr-php/src/Relay/Relay.php on line 87
Fixed / new release is out.
https://github.com/nostrver-se/nostr-php/releases/tag/1.3.3
$ bin/nostr-php --content "Hello world! Testing this fix" --key privkey --relay wss://nostr.sebastix.dev
Send to Nostr!
Still getting the string error on the $json with the full script using swentel\nostr\Relay\Relay
Switched to RelaySet and it seems to work, but it hangs after writing and throws a fatal error.
PHP Fatal error: Uncaught WebSocket\Exception\ConnectionClosedException: Connection has unexpectedly closed in /home/.../vendor/phrity/websocket/src/Connection.php:374
I didn't have access to a relay. Works now.