flow php

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.

HELPER


/**
 * Create a new filesystem table with given filesystems.
 * Filesystems can be also mounted later.
 * If no filesystems are provided, local filesystem is mounted.
 */
fstab(Filesystem $filesystems) : FilesystemTable
/**
 * Create a new memory filesystem and writes data to it in memory.
 */
memory_filesystem() : MemoryFilesystem
/**
 * Path supports glob patterns.
 * Examples:
 *  - path('*.csv') - any csv file in current directory
 *  - path('/** / *.csv') - any csv file in any subdirectory (remove empty spaces)
 *  - path('/dir/partition=* /*.parquet') - any parquet file in given partition directory.
 *
 * Glob pattern is also supported by remote filesystems like Azure
 *
 *  - path('azure-blob://directory/*.csv') - any csv file in given directory
 *
 * @param array<string, mixed> $options
 */
path(string $path, array $options) : Path
/**
 * Create a path to php memory stream.
 *
 * @param string $path - default = '' - path is used as an identifier in memory filesystem, so we can write multiple files to memory at once, each path is a new handle
 * @param null|array{'stream': 'memory'|'temp'} $options - when nothing is provided, 'temp' stream is used by default
 *
 * @return Path
 */
path_memory(string $path, ?array $options) : Path
/**
 * Resolve real path from given path.
 *
 * @param array<string, mixed> $options
 */
path_real(string $path, array $options) : Path
/**
 * Create a path to php stdout stream.
 *
 * @param null|array{'stream': 'output'|'stderr'|'stdout'} $options
 *
 * @return Path
 */
path_stdout(?array $options) : Path
/**
 * Write-only filesystem useful when we just want to write the output to stdout.
 * The main use case is for streaming datasets over http.
 */
stdout_filesystem() : StdOutFilesystem

Contributors

Join us on GitHub external resource
scroll back to top