array_schema(string $name, bool $empty, bool $nullable, ?Metadata $metadata) : Definition
Extracts
Read from various data sources.
Transforms
Shape and optimize for your needs.
Loads
Store and secure in one of many available data sinks.
Modules
DSL Functions
DSL stands for Domain Specific Language. In the case of Flow, the DSL is used to define simple functions that can be used to transform data. Most of those functions are initializing a new instance of a class under the hood since Flow is fully object-oriented. Please look at the examples below to get a better understanding of how to use the DSL functions.
SCHEMA
bool_schema(string $name, bool $nullable, ?Metadata $metadata) : Definition
datetime_schema(string $name, bool $nullable, ?Metadata $metadata) : Definition
/**
* @param class-string<\UnitEnum> $type
*/
enum_schema(string $name, string $type, bool $nullable, ?Metadata $metadata) : Definition
float_schema(string $name, bool $nullable, ?Metadata $metadata) : Definition
int_schema(string $name, bool $nullable, ?Metadata $metadata) : Definition
json_schema(string $name, bool $nullable, ?Metadata $metadata) : Definition
list_schema(string $name, ListType $type, ?Metadata $metadata) : Definition
map_schema(string $name, MapType $type, ?Metadata $metadata) : Definition
null_schema(string $name, ?Metadata $metadata) : Definition
object_schema(string $name, ObjectType $type, ?Metadata $metadata) : Definition
print_schema(Schema $schema, ?SchemaFormatter $formatter) : string
schema(Definition $definitions) : Schema
schema_evolving_matcher() : EvolvingSchemaMatcher
schema_from_json(string $schema) : Schema
schema_strict_matcher() : StrictSchemaMatcher
schema_to_json(Schema $schema, int $json_flags) : string
structure_schema(string $name, StructureType $type, ?Metadata $metadata) : Definition
struct_schema(string $name, StructureType $type, ?Metadata $metadata) : Definition
str_schema(string $name, bool $nullable, ?Metadata $metadata) : Definition
uuid_schema(string $name, bool $nullable, ?Metadata $metadata) : Definition
xml_element_schema(string $name, bool $nullable, ?Metadata $metadata) : Definition
xml_schema(string $name, bool $nullable, ?Metadata $metadata) : Definition
TYPE
structure_element(string $name, Type $type) : StructureElement
/**
* @param array<StructureElement> $elements
*/
structure_type(array $elements, bool $nullable) : StructureType
struct_element(string $name, Type $type) : StructureElement
/**
* @param array<StructureElement> $elements
*/
struct_type(array $elements, bool $nullable) : StructureType
type_array(bool $empty, bool $nullable) : ArrayType
type_boolean(bool $nullable) : ScalarType
type_callable(bool $nullable) : CallableType
type_datetime(bool $nullable) : DateTimeType
/**
* @param class-string<\UnitEnum> $class
*/
type_enum(string $class, bool $nullable) : EnumType
type_float(bool $nullable) : ScalarType
type_int(bool $nullable) : ScalarType
type_integer(bool $nullable) : ScalarType
type_json(bool $nullable) : JsonType
type_list(Type $element, bool $nullable) : ListType
type_map(ScalarType $key_type, Type $value_type, bool $nullable) : MapType
type_null() : NullType
/**
* @param class-string $class
*/
type_object(string $class, bool $nullable) : ObjectType
type_resource(bool $nullable) : ResourceType
type_string(bool $nullable) : ScalarType
/**
* @param array<StructureElement> $elements
*/
type_structure(array $elements, bool $nullable) : StructureType
type_uuid(bool $nullable) : UuidType
type_xml(bool $nullable) : XMLType
type_xml_element(bool $nullable) : XMLElementType
ENTRY
/**
* @param array<mixed> $data
*/
array_entry(string $array, ?array $data) : ArrayEntry
boolean_entry(string $name, ?bool $value) : BooleanEntry
bool_entry(string $name, ?bool $value) : BooleanEntry
datetime_entry(string $name, DateTimeInterface|string|null $value) : DateTimeEntry
enum_entry(string $name, ?UnitEnum $enum) : EnumEntry
float_entry(string $name, ?float $value) : FloatEntry
integer_entry(string $name, ?int $value) : IntegerEntry
int_entry(string $name, ?int $value) : IntegerEntry
json_entry(string $name, array|string|null $data) : JsonEntry
/**
* @throws InvalidArgumentException
*/
json_object_entry(string $name, array|string|null $data) : JsonEntry
list_entry(string $name, ?array $value, ListType $type) : ListEntry
map_entry(string $name, ?array $value, MapType $mapType) : MapEntry
object_entry(string $name, ?object $data) : ObjectEntry
obj_entry(string $name, ?object $data) : ObjectEntry
string_entry(string $name, ?string $value) : StringEntry
structure_entry(string $name, ?array $value, StructureType $type) : StructureEntry
struct_entry(string $name, ?array $value, StructureType $type) : StructureEntry
str_entry(string $name, ?string $value) : StringEntry
uuid_entry(string $name, Uuid|string|null $value) : UuidEntry
xml_element_entry(string $name, DOMElement|string|null $value) : XMLElementEntry
xml_entry(string $name, DOMDocument|string|null $value) : XMLEntry
DATA_FRAME
append() : SaveMode
/**
* @param array<array<mixed>>|array<mixed|string> $data
* @param array<Partition>|Partitions $partitions
*/
array_to_row(array $data, EntryFactory $entryFactory, Partitions|array $partitions, ?Schema $schema) : Row
/**
* @param array<array<mixed>>|array<mixed|string> $data
* @param array<Partition>|Partitions $partitions
*/
array_to_rows(array $data, EntryFactory $entryFactory, Partitions|array $partitions, ?Schema $schema) : Rows
/**
* An alias for `ref`.
*/
col(string $entry) : EntryReference
compare_entries_by_name(Order $order) : Comparator
compare_entries_by_name_desc() : Comparator
/**
* @param array<class-string<Entry>, int> $priorities
*/
compare_entries_by_type(array $priorities, Order $order) : Comparator
/**
* @param array<class-string<Entry>, int> $priorities
*/
compare_entries_by_type_and_name(array $priorities, Order $order) : Comparator
/**
* @param array<class-string<Entry>, int> $priorities
*/
compare_entries_by_type_desc(array $priorities) : Comparator
config() : Config
config_builder() : ConfigBuilder
data_frame(Config|ConfigBuilder|null $config) : Flow
/**
* Alias for data_frame() : Flow.
*/
df(Config|ConfigBuilder|null $config) : Flow
dom_element_to_string(DOMElement $element, bool $format_output, bool $preserver_white_space) : string|false
entries(Entry $entries) : Entries
exception_if_exists() : SaveMode
execution_context(?Config $config) : FlowContext
filesystem_cache(Path|string|null $cache_dir, Filesystem $filesystem, Serializer $serializer) : FilesystemCache
flow_context(?Config $config) : FlowContext
generate_random_int(int $start, int $end, NativePHPRandomValueGenerator $generator) : int
generate_random_string(int $length, NativePHPRandomValueGenerator $generator) : string
get_type(?mixed $value) : Type
ignore() : SaveMode
ignore_error_handler() : IgnoreError
/**
* @param array<string|Type> $types
* @param mixed $value
*/
is_type(array $types, ?mixed $value) : bool
join_on(Comparison|array $comparisons, string $join_prefix) : Expression
overwrite() : SaveMode
print_rows(Rows $rows, int|bool $truncate, ?Formatter $formatter) : string
random_string(ScalarFunction|int $length, RandomValueGenerator $generator) : RandomString
row(Entry $entry) : Row
rows(Row $row) : Rows
rows_partitioned(array $rows, Partitions|array $partitions) : Rows
row_number() : RowNumber
skip_rows_handler() : SkipRows
throw_error_handler() : ThrowError
window() : Window
EXTRACTOR
/**
* @param int<1, max> $chunk_size
*/
chunks_from(Extractor $extractor, int $chunk_size) : ChunkExtractor
files(Path|string $directory) : FilesExtractor
from_all(Extractor $extractors) : ChainExtractor
/**
* @param iterable $array
* @param null|Schema $schema - @deprecated use withSchema() method instead
*/
from_array(iterable $array, ?Schema $schema) : ArrayExtractor
/**
* @param string $id - cache id from which data will be extracted
* @param null|Extractor $fallback_extractor - extractor that will be used when cache is empty - @deprecated use withFallbackExtractor() method instead
* @param bool $clear - clear cache after extraction - @deprecated use withClearOnFinish() method instead
*/
from_cache(string $id, ?Extractor $fallback_extractor, bool $clear) : CacheExtractor
from_data_frame(DataFrame $data_frame) : DataFrameExtractor
from_memory(Memory $memory) : MemoryExtractor
from_path_partitions(Path|string $path) : PathPartitionsExtractor
from_pipeline(Pipeline $pipeline) : PipelineExtractor
from_rows(Rows $rows) : RowsExtractor
from_sequence_date_period(string $entry_name, DateTimeInterface $start, DateInterval $interval, DateTimeInterface $end, int $options) : SequenceExtractor
from_sequence_date_period_recurrences(string $entry_name, DateTimeInterface $start, DateInterval $interval, int $recurrences, int $options) : SequenceExtractor
from_sequence_number(string $entry_name, string|int|float $start, string|int|float $end, int|float $step) : SequenceExtractor
AGGREGATING_FUNCTION
average(EntryReference|string $ref) : Average
collect(EntryReference|string $ref) : Collect
collect_unique(EntryReference|string $ref) : CollectUnique
count(EntryReference $function) : Count
first(EntryReference|string $ref) : First
last(EntryReference|string $ref) : Last
max(EntryReference|string $ref) : Max
min(EntryReference|string $ref) : Min
sum(EntryReference|string $ref) : Sum
SCALAR_FUNCTION
all(ScalarFunction $functions) : All
any(ScalarFunction $values) : Any
array_exists(ScalarFunction|array $ref, ScalarFunction|string $path) : ArrayPathExists
/**
* Expands each value into entry, if there are more than one value, multiple rows will be created.
* Array keys are ignored, only values are used to create new rows.
*
* Before:
* +--+-------------------+
* |id| array|
* +--+-------------------+
* | 1|{"a":1,"b":2,"c":3}|
* +--+-------------------+
*
* After:
* +--+--------+
* |id|expanded|
* +--+--------+
* | 1| 1|
* | 1| 2|
* | 1| 3|
* +--+--------+
*/
array_expand(ScalarFunction $function, ArrayExpand $expand) : ArrayExpand
array_get(ScalarFunction $ref, ScalarFunction|string $path) : ArrayGet
array_get_collection(ScalarFunction $ref, ScalarFunction|array $keys) : ArrayGetCollection
array_get_collection_first(ScalarFunction $ref, string $keys) : ArrayGetCollection
array_keys_style_convert(ScalarFunction $ref, StringStyles|string $style) : ArrayKeysStyleConvert
array_key_rename(ScalarFunction $ref, ScalarFunction|string $path, ScalarFunction|string $newName) : ArrayKeyRename
array_merge(ScalarFunction|array $left, ScalarFunction|array $right) : ArrayMerge
array_merge_collection(ScalarFunction|array $array) : ArrayMergeCollection
array_reverse(ScalarFunction|array $function, ScalarFunction|bool $preserveKeys) : ArrayReverse
array_sort(ScalarFunction $function, ScalarFunction|Sort|null $sort_function, ScalarFunction|int|null $flags, ScalarFunction|bool $recursive) : ArraySort
/**
* Unpacks each element of an array into a new entry, using the array key as the entry name.
*
* Before:
* +--+-------------------+
* |id| array|
* +--+-------------------+
* | 1|{"a":1,"b":2,"c":3}|
* | 2|{"d":4,"e":5,"f":6}|
* +--+-------------------+
*
* After:
* +--+-----+-----+-----+-----+-----+
* |id|arr.b|arr.c|arr.d|arr.e|arr.f|
* +--+-----+-----+-----+-----+-----+
* | 1| 2| 3| | | |
* | 2| | | 4| 5| 6|
* +--+-----+-----+-----+-----+-----+
*/
array_unpack(ScalarFunction|array $array, ScalarFunction|array $skip_keys, ScalarFunction|string|null $entry_prefix) : ArrayUnpack
between(?mixed $value, ?mixed $lower_bound, ?mixed $upper_bound, ScalarFunction|Boundary $boundary) : Between
/**
* @param array<mixed> $params
*/
call_method(object $object, ScalarFunction|string $method, array $params) : CallMethod
capitalize(ScalarFunction|string $value) : Capitalize
cast(?mixed $value, ScalarFunction|Type|string $type) : Cast
combine(ScalarFunction|array $keys, ScalarFunction|array $values) : Combine
concat(ScalarFunction|string $functions) : Concat
date_time_format(ScalarFunction $ref, string $format) : DateTimeFormat
/**
* An alias for `ref`.
*/
entry(string $entry) : EntryReference
exists(ScalarFunction $ref) : Exists
hash(?mixed $value, Algorithm $algorithm) : Hash
list_ref(string $entry) : ListFunctions
lit(?mixed $value) : Literal
lower(ScalarFunction|string $value) : ToLower
not(ScalarFunction $value) : Not
now(DateTimeZone|ScalarFunction $time_zone) : Now
number_format(ScalarFunction|int|float $value, ScalarFunction|int $decimals, ScalarFunction|string $decimal_separator, ScalarFunction|string $thousands_separator) : NumberFormat
optional(ScalarFunction $function) : Optional
ref(string $entry) : EntryReference
refs(Reference|string $entries) : References
regex(ScalarFunction|string $pattern, ScalarFunction|string $subject, ScalarFunction|int $flags, ScalarFunction|int $offset) : Regex
regex_all(ScalarFunction|string $pattern, ScalarFunction|string $subject, ScalarFunction|int $flags, ScalarFunction|int $offset) : RegexAll
regex_match(ScalarFunction|string $pattern, ScalarFunction|string $subject, ScalarFunction|int $flags, ScalarFunction|int $offset) : RegexMatch
regex_match_all(ScalarFunction|string $pattern, ScalarFunction|string $subject, ScalarFunction|int $flags, ScalarFunction|int $offset) : RegexMatchAll
regex_replace(ScalarFunction|string $pattern, ScalarFunction|string $replacement, ScalarFunction|string $subject, ScalarFunction|int|null $limit) : RegexReplace
round(ScalarFunction|int|float $value, ScalarFunction|int $precision, ScalarFunction|int $mode) : Round
sanitize(ScalarFunction|string $value, ScalarFunction|string $placeholder, ScalarFunction|int|null $skipCharacters) : Sanitize
size(?mixed $value) : Size
split(ScalarFunction|string $value, ScalarFunction|string $separator, ScalarFunction|int $limit) : Split
sprintf(ScalarFunction|string $format, ScalarFunction|string|int|float|null $args) : Sprintf
structure_ref(string $entry) : StructureFunctions
to_date(?mixed $ref, ScalarFunction|string $format, ScalarFunction|DateTimeZone $timeZone) : ToDate
to_date_time(?mixed $ref, ScalarFunction|string $format, ScalarFunction|DateTimeZone $timeZone) : ToDateTime
to_timezone(ScalarFunction|DateTimeInterface $value, ScalarFunction|DateTimeZone|string $timeZone) : ToTimeZone
ulid(ScalarFunction|string|null $value) : Ulid
upper(ScalarFunction|string $value) : ToUpper
uuid_v4() : Uuid
uuid_v7(ScalarFunction|DateTimeInterface|null $value) : Uuid
when(?mixed $condition, ?mixed $then, ?mixed $else) : When
WINDOW_FUNCTION
dense_rank() : DenseRank
dens_rank() : DenseRank
rank() : Rank
COMPARISON
compare_all(Comparison $comparisons) : All
compare_any(Comparison $comparisons) : Any
equal(Reference|string $left, Reference|string $right) : Equal
identical(Reference|string $left, Reference|string $right) : Identical
LOADER
/**
* Convert rows to an array and store them in passed array variable.
*
* @param-out array<array<mixed>> $array
*/
to_array(array $array) : ArrayLoader
to_branch(ScalarFunction $condition, Loader $loader) : Loader
to_callable(callable $callable) : CallbackLoader
to_memory(Memory $memory) : MemoryLoader
to_output(int|bool $truncate, Output $output, Formatter $formatter, SchemaFormatter $schemaFormatter) : StreamLoader
to_stderr(int|bool $truncate, Output $output, Formatter $formatter, SchemaFormatter $schemaFormatter) : StreamLoader
to_stdout(int|bool $truncate, Output $output, Formatter $formatter, SchemaFormatter $schemaFormatter) : StreamLoader
to_stream(string $uri, int|bool $truncate, Output $output, string $mode, Formatter $formatter, SchemaFormatter $schemaFormatter) : StreamLoader
to_transformation(Transformer $transformer, Loader $loader) : TransformerLoader