Overview
revolution/laravel-nostr is a package for using the Nostr protocol from Laravel. It provides key generation and conversion, event retrieval and publishing, pool (multi-relay) support, NIP-05 profiles, NIP-17 Private Direct Messages, and Laravel Notifications integration.Because the Nostr specifications are still evolving, this package is under constant development. However, the notification features are already useful as-is.
Drivers
This package provides two drivers.The
native driver does not support NIP-04.Setting the default driver
Set the default driver inconfig/nostr.php or .env.
Installation
1
Install the package
2
Publish the configuration file
Key management
Generate new keys
Convert keys
Convert from nsec:Getting events
Get multiple events
Get one event
Publishing events
Publish to a single relay
Publish to multiple relays (pool)
Relay server configuration
Which relay servers are used?
When usingNostr::event() alone, the first relay in config/nostr.php is used. When using Nostr::pool(), all relays in the configuration are used.
Change relay server at runtime
NIP-05 profile
NIP-17 Private Direct Messages
NIP-17 is only supported in the
native driver.Send a private direct message
Decrypt a received private direct message
Laravel Notifications
UseNostrChannel to send messages to Nostr through Laravel Notifications.
Notification class
On-demand notifications
User model integration
Relay servers for notifications
By default, all relays inconfig/nostr.php are used. Specify relays in NostrRoute to change them at runtime.
For the latest information, see the GitHub repository.