WhatsApp PHP

Media
in package

WhatsApp PHP Media entity.

Tags
author

Gabriel Silva

license

MIT

Table of Contents

Properties

$extension  : string
Media extension.
$filename  : string|null
Media custom filename, if any.
$type  : string
Media mime type, if any.
$url  : string
Media URL.

Methods

__construct()  : mixed
Create Media entity.
downloadFile()  : string
Downloads the media file, if available, to the local disk.

Properties

$extension

Media extension.

public string $extension

$filename

Media custom filename, if any.

public string|null $filename

$type

Media mime type, if any.

public string $type

$url

Media URL.

public string $url

Methods

__construct()

Create Media entity.

public __construct([array<string|int, mixed> $data = [] ]) : mixed
Parameters
$data : array<string|int, mixed> = []

(Optional) Associative array of data to populate.

downloadFile()

Downloads the media file, if available, to the local disk.

public downloadFile(string $path[, string $filename = null ]) : string
Parameters
$path : string

Location folder in where to salve the file.

$filename : string = null

(Optional) Custom filename to set, leave blank to use the original filename.

Tags
throws
DownloadMediaException

Throws an exception if the download is not available or the download fails.

Return values
string

Returns the downloaded file location.


        
On this page

Search results