Documentation

Event
in package
implements EventInterface

Table of Contents

Interfaces

EventInterface

Properties

$content  : string
The event content.
$created_at  : int
The created at timestamp.
$id  : string
The event id.
$kind  : int
The event kind.
$pubkey  : string
The public key.
$sig  : string
The event signature.
$tags  : array<string|int, mixed>
The event tags.

Methods

__construct()  : mixed
Base constructor for events.
addTag()  : $this
Add an event tag.
getContent()  : string
Get the event content.
getCreatedAt()  : int
Get the event created time.
getId()  : string
Get the Id.
getKind()  : int
Returns the kind.
getPublicKey()  : string
Get the public key.
getSignature()  : string
Get the signature.
getTags()  : array<string|int, mixed>
Get the event tags.
setContent()  : $this
Set the event content.
setCreatedAt()  : $this
Set the event created time.
setId()  : $this
Set the id.
setKind()  : $this
Set the event kind.
setPublicKey()  : $this
Set the public key.
setSignature()  : $this
Set the signature.
setTags()  : $this
Set the event tags with values.
toArray()  : array<string|int, mixed>
Convert the object to an array.
toJson()  : string
Convert the event object to a JSON string.
verify()  : bool
Returns true if event object encodes to a valid Nostr event JSON string.

Properties

$content

The event content.

protected string $content = ''

$created_at

The created at timestamp.

protected int $created_at = 0

$id

The event id.

protected string $id = ''

$kind

The event kind.

protected int $kind = 0

Override this property in your custom events to set the value immediately.

$pubkey

The public key.

protected string $pubkey

$sig

The event signature.

protected string $sig = ''

$tags

The event tags.

protected array<string|int, mixed> $tags = []

Methods

__construct()

Base constructor for events.

public __construct() : mixed

addTag()

Add an event tag.

public addTag(array<string|int, mixed> $tag) : $this
Parameters
$tag : array<string|int, mixed>
Return values
$this

getContent()

Get the event content.

public getContent() : string
Return values
string

getCreatedAt()

Get the event created time.

public getCreatedAt() : int
Return values
int

getId()

Get the Id.

public getId() : string
Return values
string

getKind()

Returns the kind.

public getKind() : int
Return values
int

getPublicKey()

Get the public key.

public getPublicKey() : string
Return values
string

getSignature()

Get the signature.

public getSignature() : string
Return values
string

getTags()

Get the event tags.

public getTags() : array<string|int, mixed>
Return values
array<string|int, mixed>

setContent()

Set the event content.

public setContent(string $content) : $this
Parameters
$content : string
Return values
$this

setCreatedAt()

Set the event created time.

public setCreatedAt(int $time) : $this
Parameters
$time : int
Return values
$this

setId()

Set the id.

public setId(string $id) : $this
Parameters
$id : string
Return values
$this

setKind()

Set the event kind.

public setKind(int $kind) : $this
Parameters
$kind : int
Return values
$this

setPublicKey()

Set the public key.

public setPublicKey(string $public_key) : $this
Parameters
$public_key : string
Return values
$this

setSignature()

Set the signature.

public setSignature(string $sig) : $this
Parameters
$sig : string
Return values
$this

setTags()

Set the event tags with values.

public setTags(array<string|int, mixed> $tags) : $this
Parameters
$tags : array<string|int, mixed>

[] [ ["e", "..."], ["p", "...", "..."], ]

Return values
$this

toArray()

Convert the object to an array.

public toArray([array<string|int, mixed> $ignore_properties = [] ]) : array<string|int, mixed>
Parameters
$ignore_properties : array<string|int, mixed> = []
Return values
array<string|int, mixed>

toJson()

Convert the event object to a JSON string.

public toJson() : string
Return values
string

verify()

Returns true if event object encodes to a valid Nostr event JSON string.

public verify([string $json = '' ]) : bool
Parameters
$json : string = ''
Return values
bool

        
On this page

Search results