Examples menu

๐Ÿ” Live Search

Type to filter PHP stdlib functions server-side. Every keystroke is a round-trip โ€” and nobody shipped a line of search logic to the browser.

data-on:input__throttle.100ms.trailing fires at most once every 100 ms while the user types, and always fires one final time at the end โ€” so the last keystroke is never dropped. No setTimeout written by you.
Server-side filtering is intentional. The query parser, category filter, and result ranking all live in PHP. Swap the hardcoded array for a database query and nothing else changes.
$c->sync() re-renders the view for this tab only โ€” no broadcast, no shared state. Other users' searches are completely isolated.
Signals are injected into the context before the action closure runs. By the time the view callable executes, $query->string() already holds the current input value.
Callable views re-run on every sync, computing fresh results. The client receives rendered HTML via SSE โ€” no JSON payload, no client-side fetch() logic.

122 functions

Function Category Description
array_map Array Applies a callback to every element and returns the result array.
array_filter Array Filters elements using a callback; returns only matching entries.
array_reduce Array Iteratively reduces an array to a single value via callback.
array_walk Array Applies a callback to every element, optionally modifying values in place.
array_keys Array Returns all keys of an array.
array_values Array Returns all values of an array, re-indexed from 0.
array_slice Array Extracts a portion of an array by offset and length.
array_splice Array Removes elements and optionally inserts new ones in their place.
array_merge Array Merges one or more arrays, re-indexing numeric keys.
array_unique Array Removes duplicate values from an array.
array_flip Array Exchanges keys and values of an array.
array_reverse Array Returns an array with elements in reverse order.
array_push Array Pushes one or more elements onto the end of an array.
array_pop Array Pops the last element off an array and returns it.
array_shift Array Removes and returns the first element of an array.
array_unshift Array Prepends one or more elements to the front of an array.
array_chunk Array Splits an array into chunks of a given size.
array_combine Array Creates an array using one array as keys and another as values.
array_diff Array Computes the difference of arrays โ€” values in first but not the rest.
array_intersect Array Computes the intersection of arrays โ€” values present in all.
in_array Array Checks whether a given value exists in an array.
count Array Counts elements in an array or countable object.
sort Array Sorts an array by value in ascending order.
rsort Array Sorts an array by value in descending order.
asort Array Sorts by value, maintaining key-value associations.
ksort Array Sorts an array by key in ascending order.
usort Array Sorts by value using a user-defined comparison function.
uasort Array Sorts preserving index association with a user-defined comparison.
uksort Array Sorts by keys using a user-defined comparison function.
compact Array Creates an array from variables, using their names as keys.
extract Array Imports variables from an array into the local symbol table.
str_contains String Returns true if the string contains the given substring.
str_starts_with String Checks whether a string begins with a given prefix.
str_ends_with String Checks whether a string ends with a given suffix.
str_replace String Replaces all occurrences of a search string with a replacement.
str_pad String Pads a string to a specified length with another string.
str_split String Splits a string into an array of characters or chunks.
str_repeat String Returns a string repeated a given number of times.
str_word_count String Counts the number of words in a string.
strlen String Returns the byte length of a string.
mb_strlen String Returns the character length of a multibyte string.
substr String Returns part of a string, starting at offset for a given length.
mb_substr String Returns part of a multibyte string โ€” safe for Unicode.
strpos String Finds the byte-position of the first occurrence of a substring.
strrpos String Finds the byte-position of the last occurrence of a substring.
strtolower String Converts a string to lowercase.
strtoupper String Converts a string to uppercase.
ucfirst String Uppercases the first character of a string.
ucwords String Uppercases the first character of each word.
lcfirst String Lowercases the first character of a string.
trim String Strips whitespace (or other characters) from both ends.
ltrim String Strips whitespace from the beginning of a string.
rtrim String Strips whitespace from the end of a string.
explode String Splits a string by a delimiter into an array.
implode String Joins array elements together with a glue string.
sprintf String Returns a formatted string using printf-style format specifiers.
number_format String Formats a number with grouped thousands and decimal separator.
preg_match String Performs a regular expression match; returns the match count.
preg_replace String Performs a regular expression search and replace.
preg_split String Splits a string by a regular expression pattern.
htmlspecialchars String Converts special characters to HTML entity equivalents.
strip_tags String Removes HTML and PHP tags from a string.
nl2br String Inserts <br> line-break tags before all newlines in a string.
wordwrap String Wraps a string to a given number of characters.
abs Math Returns the absolute value of a number.
ceil Math Rounds a float up to the nearest integer.
floor Math Rounds a float down to the nearest integer.
round Math Rounds a float to the nearest integer (or given decimal places).
min Math Returns the smallest value from arguments or an array.
max Math Returns the largest value from arguments or an array.
rand Math Generates a pseudo-random integer between min and max.
mt_rand Math Faster pseudo-random integer via Mersenne Twister algorithm.
random_int Math Generates a cryptographically secure random integer.
pow Math Returns base raised to the power of exp.
sqrt Math Returns the square root of a number.
log Math Returns the natural logarithm (or log to a custom base).
fmod Math Returns the floating-point remainder of a division.
intdiv Math Returns the integer quotient of a division.
pi Math Returns the value of ฯ€ (approx. 3.14159).
date Date Formats a Unix timestamp as a date/time string.
time Date Returns the current Unix timestamp as an integer.
mktime Date Returns Unix timestamp for a given date and time.
strtotime Date Parses a date/time string (e.g. "next Monday") into a Unix timestamp.
microtime Date Returns the current Unix timestamp with microseconds.
checkdate Date Validates a Gregorian date given month, day, and year.
date_create Date Creates a new DateTime object from a date string.
date_format Date Formats a DateTime object into a localized date string.
date_diff Date Returns the difference between two DateTime objects.
date_add Date Adds a DateInterval to a DateTime object.
date_sub Date Subtracts a DateInterval from a DateTime object.
date_modify Date Alters a DateTime timestamp using a relative date string.
json_encode Data Encodes a PHP value into a JSON-formatted string.
json_decode Data Decodes a JSON string into a PHP value (or null on failure).
serialize Data Generates a storable representation of any PHP value.
unserialize Data Creates a PHP value from a serialized representation.
base64_encode Data Encodes binary data using the MIME Base64 scheme.
base64_decode Data Decodes data encoded with the MIME Base64 scheme.
md5 Data Calculates the MD5 hash of a string (not safe for passwords).
sha1 Data Calculates the SHA1 hash of a string.
hash Data Generates a hash value with a named algorithm (SHA-256, etc.).
hash_hmac Data Generates a keyed hash using the HMAC method.
crc32 Data Calculates the 32-bit CRC checksum of a string.
isset Misc Returns true if a variable is set and not null.
empty Misc Returns true if a variable is empty (0, "", null, false, []).
unset Misc Destroys one or more specified variables.
var_dump Misc Dumps detailed type and value information about a variable.
var_export Misc Outputs or returns a parsable PHP representation of a value.
print_r Misc Prints human-readable information about a variable.
gettype Misc Returns the type of a variable as a string.
get_debug_type Misc Returns the debug type โ€” class name for objects, PHP type for scalars.
is_array Misc Checks whether a variable is an array.
is_string Misc Checks whether a variable is a string.
is_int Misc Checks whether a variable is an integer.
is_float Misc Checks whether a variable is a float.
is_bool Misc Checks whether a variable is a boolean.
is_null Misc Checks whether a variable is null.
is_numeric Misc Checks whether a variable is numeric or a numeric string.
is_callable Misc Checks whether a value can be called as a function.
function_exists Misc Returns true if the named function is defined.
class_exists Misc Returns true if the named class is defined.
method_exists Misc Returns true if a method exists on an object or class.

โšก Signals

query string TAB ""

Current text in the search box. Injected from the browser before the action closure runs.

category string TAB "all"

Active category filter. Set via ?cat= query param when the user clicks a filter pill.

๐ŸŽฏ Actions

search

Reads optional ?cat= param to override category, then calls $c->sync() to re-render the results block.

๐Ÿ‘ Views

live_search.html.twig

Callable view โ€” re-runs on every sync, filtering the PHP stdlib dataset from current signal values. Only the results block is re-rendered on updates.