Util
in package
WhatsApp PHP utility class.
Tags
Table of Contents
Methods
- downloadFile() : string
- Downloads a remote file.
- formatNumber() : string
- Formats a phone to international number.
- snakeToCamelCase() : string
- Converts a snake_case string to camelCase.
- stringContains() : bool
- Checks if a string contains a substring.
Methods
downloadFile()
Downloads a remote file.
public
static downloadFile(string $url, string $path[, string $filename = null ]) : string
Parameters
- $url : string
-
Remote URL to download.
- $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
Return values
string —Returns the downloaded file location.
formatNumber()
Formats a phone to international number.
public
static formatNumber(string $number) : string
Parameters
- $number : string
-
Number to format.
Return values
string —Returns the formatted number.
snakeToCamelCase()
Converts a snake_case string to camelCase.
public
static snakeToCamelCase(string $name) : string
Parameters
- $name : string
-
String to convert.
Return values
string —Returns the converted string.
stringContains()
Checks if a string contains a substring.
public
static stringContains(string $haystack, string $needle) : bool
Parameters
- $haystack : string
-
The string to search in.
- $needle : string
-
The substring to search for.
Return values
bool —True if contains, false otherwise.