To::_()
Creates a virtual method.
Table of Contents
Description
To::_(...$lot): mixed;This method adds a new static method dynamically so that it can be used later as if it were a native method.
Example
// This register will make method `To::RGB()` available for use
To::_('RGB', static function (string $rgb): array {
[$r, $g, $b] = str_split(substr($rgb, 1), 2);
return [hexdec($r), hexdec($g), hexdec($b)];
});To::HTML()
Decodes HTML special characters.
To::JSON()
Encodes data to JSON string.
To::URL()
Converts private file path to public URL, or decodes URL special characters.
To::_()
Creates a virtual method.
To::__callStatic()
Calls the virtual method that has been created.
To::base64()
Encodes to Base64 string.
To::camel()
Converts current value to camel case.
To::entity()
Converts characters to their corresponding HTML entities.
To::file()
Converts current value to a safe file name.
To::folder()
Converts current value to a safe folder name.
To::kebab()
Converts current value to kebab/slug case.
To::lower()
Converts current value to lower case.
To::pascal()
Converts current value to pascal case.
To::path()
Converts public URL to private file path.
To::query()
Converts PHP array to URL query string.
To::serial()
Serializes data.
To::snake()
Converts current value to snake case.
To::text()
Converts current value to plain text.
To::upper()
Converts current value to upper case.