Message
in package
WhatsApp PHP Message entity.
Tags
Table of Contents
Properties
- $body : string
- Message body.
- $date : DateTime|string
- Message date.
- $from : string
- Message from number.
- $id : string
- Message ID.
- $isBroadcast : bool
- Is message from a broadcast?
- $isForwarded : bool
- Is forwarded message?
- $isMine : bool
- Was the message sent by me?
- $isTemporary : bool
- Is message temporary?
- $location : Location|null
- Message location, if any.
- $media : Media|null
- Message media, if any.
- $to : string
- Message to number.
- $type : string
- Message type.
Methods
- __construct() : mixed
- Create Message entity.
- __toString() : string
- Gets the message body as string.
- getFromProfile() : Profile|null
- Gets the profile of the message sender.
- getToProfile() : Profile|null
- Gets the profile of the message receiver.
- reply() : bool
- Replies the message to the sender.
Properties
$body
Message body.
public
string
$body
$date
Message date.
public
DateTime|string
$date
$from
Message from number.
public
string
$from
$id
Message ID.
public
string
$id
$isBroadcast
Is message from a broadcast?
public
bool
$isBroadcast
$isForwarded
Is forwarded message?
public
bool
$isForwarded
$isMine
Was the message sent by me?
public
bool
$isMine
$isTemporary
Is message temporary?
public
bool
$isTemporary
$location
Message location, if any.
public
Location|null
$location
$media
Message media, if any.
public
Media|null
$media
$to
Message to number.
public
string
$to
$type
Message type.
public
string
$type
Methods
__construct()
Create Message entity.
public
__construct([array<string|int, mixed> $data = [] ]) : mixed
Parameters
- $data : array<string|int, mixed> = []
-
(Optional) Associative array of data to populate.
__toString()
Gets the message body as string.
public
__toString() : string
Return values
string —Message body.
getFromProfile()
Gets the profile of the message sender.
public
getFromProfile() : Profile|null
Tags
Return values
Profile|null —Returns the profile if found.
getToProfile()
Gets the profile of the message receiver.
public
getToProfile() : Profile|null
Tags
Return values
Profile|null —Returns the profile if found.
reply()
Replies the message to the sender.
public
reply(string $message) : bool
Parameters
- $message : string
-
Message body.
Tags
Return values
bool —Returns true on success, false on failure.