Filters
final class Filters
| internal | 
Template filters. Uses UTF-8 only.
Properties
| $locale | 
Methods
Replaces all repeated white spaces with a single space.
Output buffering handler for spacelessHtml.
Replaces all repeated white spaces with a single space.
Indents plain text or HTML the content from the left.
Join array of text or HTML elements with a string.
Splits a string by a string.
Date/time formatting.
Date/time formatting according to locale.
Formats a number with grouped thousands and optionally decimal digits according to locale.
Converts to human-readable file size.
Performs a search and replace.
Perform a regular expression search and replace.
The data: URI generator.
No description
Returns a part of string.
Truncates string to maximal length.
Convert to lower case.
Convert to upper case.
Convert first character to lower case.
Convert first character to upper case.
Capitalize string.
Returns length of string or iterable.
Pad a string to a certain length with another string.
Pad a string to a certain length with another string.
Reverses string or array.
Chunks items by returning an array of arrays with the given number of items.
Sorts elements using the comparison function and preserves the key association.
Groups elements by the element indices and preserves the key association and order.
Filters elements according to a given $predicate. Maintains original keys.
Returns value clamped to the inclusive range of min and max.
Generates URL-encoded query string
Is divisible by?
Is odd?
Is even?
Returns the first element in an array or character in a string, or null if none.
Returns the last element in an array or character in a string, or null if none.
Extracts a slice of an array or string.
No description
No description
No description
Picks random element/char.
Sanitizes string for use inside href attribute.
Details
        at line 34
                static            string
    stripHtml(FilterInfo $info, $s)
        
    
    Converts HTML to plain text.
        at line 45
                static            string
    stripTags(FilterInfo $info, $s)
        
    
    Removes tags from HTML (but remains HTML entities).
        at line 56
                static            string
    strip(FilterInfo $info, string $s)
        
    
    Replaces all repeated white spaces with a single space.
        at line 67
                static            string
    spacelessHtml(string $s, bool $strip = true)
        
    
    Replaces all repeated white spaces with a single space.
        at line 87
                static            string
    spacelessHtmlHandler(string $s, int|null $phase = null)
        
    
    Output buffering handler for spacelessHtml.
        at line 112
                static            string
    spacelessText(string $s)
        
    
    Replaces all repeated white spaces with a single space.
        at line 121
                static            string
    indent(FilterInfo $info, string $s, int $level = 1, string $chars = "\t")
        
    
    Indents plain text or HTML the content from the left.
        at line 145
                static            string
    implode(array $arr, string $glue = '')
        
    
    Join array of text or HTML elements with a string.
        at line 154
                static            array
    explode(string $value, string $separator = '')
        
    
    Splits a string by a string.
        at line 165
                static            string
    repeat(FilterInfo $info, $s, int $count)
        
    
    Repeats text.
        at line 174
                static            string|null
    date(string|int|DateTimeInterface|DateInterval|null $time, string|null $format = null)
        
    
    Date/time formatting.
        at line 194
                            string|null
    localDate(string|int|DateTimeInterface|null $value, string|null $format = null, string|null $date = null, string|null $time = null)
        
    
    Date/time formatting according to locale.
        at line 233
                            string
    number(float $number, string|int $patternOrDecimals = 0, string $decimalSeparator = '.', string $thousandsSeparator = ',')
        
    
    Formats a number with grouped thousands and optionally decimal digits according to locale.
        at line 262
                            string
    bytes(float $bytes, int $precision = 2)
        
    
    Converts to human-readable file size.
        at line 289
                static            string
    replace(FilterInfo $info, string|array $subject, string|array $search, string|array|null $replace = null)
        
    
    Performs a search and replace.
        at line 314
                static            string
    replaceRe(string $subject, string $pattern, string $replacement = '')
        
    
    Perform a regular expression search and replace.
        at line 328
                static            string
    dataStream(string $data, string|null $type = null)
        
    
    The data: URI generator.
        at line 335
                static            Html
    breaklines(string|Stringable|null $s)
        
    
    No description
        at line 345
                static            string
    substring(string|Stringable|null $s, int $start, int|null $length = null)
        
    
    Returns a part of string.
        at line 359
                static            string
    truncate(string|Stringable|null $s, int $length, string $append = "…")
        
    
    Truncates string to maximal length.
        at line 382
                static            string
    lower($s)
        
    
    Convert to lower case.
        at line 391
                static            string
    upper($s)
        
    
    Convert to upper case.
        at line 400
                static            string
    firstLower($s)
        
    
    Convert first character to lower case.
        at line 410
                static            string
    firstUpper($s)
        
    
    Convert first character to upper case.
        at line 420
                static            string
    capitalize($s)
        
    
    Capitalize string.
        at line 429
                static            int
    length(array|Countable|Traversable|string $val)
        
    
    Returns length of string or iterable.
        at line 454
                static            string
    trim(FilterInfo $info, string $s, string $charlist = " \t\n\r\x00\v ")
        
    
    Strips whitespace.
        at line 469
                static            string
    padLeft($s, int $length, string $append = ' ')
        
    
    Pad a string to a certain length with another string.
        at line 481
                static            string
    padRight($s, int $length, string $append = ' ')
        
    
    Pad a string to a certain length with another string.
        at line 493
                static            string|array
    reverse(string|iterable $val, bool $preserveKeys = false)
        
    
    Reverses string or array.
        at line 508
                static            Generator
    batch(iterable $list, int $length, $rest = null)
        
    
    Chunks items by returning an array of arrays with the given number of items.
        at line 538
                            iterable
    sort(iterable $data, Closure|null $comparison = null, string|int|Closure|null $by = null, string|int|Closure|bool $byKey = false)
        
    
    Sorts elements using the comparison function and preserves the key association.
        at line 590
                static            iterable
    group(iterable $data, string|int|Closure $by)
        
    
    Groups elements by the element indices and preserves the key association and order.
        at line 624
                static            iterable
    filter(iterable $iterable, callable $predicate)
        
    
    Filters elements according to a given $predicate. Maintains original keys.
        at line 637
                static            int|float
    clamp(int|float $value, int|float $min, int|float $max)
        
    
    Returns value clamped to the inclusive range of min and max.
        at line 650
                static            string
    query(string|array $data)
        
    
    Generates URL-encoded query string
        at line 661
                static            bool
    divisibleBy(int $value, int $by)
        
    
    Is divisible by?
        at line 670
                static            bool
    odd(int $value)
        
    
    Is odd?
        at line 679
                static            bool
    even(int $value)
        
    
    Is even?
        at line 688
                static            mixed
    first(string|iterable $value)
        
    
    Returns the first element in an array or character in a string, or null if none.
        at line 705
                static            mixed
    last(string|array $value)
        
    
    Returns the last element in an array or character in a string, or null if none.
        at line 716
                static            string|array
    slice(string|array $value, int $start, int|null $length = null, bool $preserveKeys = false)
        
    
    Extracts a slice of an array or string.
        at line 729
                static            float
    round(float $value, int $precision = 0)
        
    
    No description
        at line 735
                static            float
    floor(float $value, int $precision = 0)
        
    
    No description
        at line 741
                static            float
    ceil(float $value, int $precision = 0)
        
    
    No description
        at line 750
                static            mixed
    random(string|array $values)
        
    
    Picks random element/char.
        at line 765
                static            string
    sanitizeUrl($s)
        
    
    Sanitizes string for use inside href attribute.