flow php

UNIFIED DATA PROCESSING FRAMEWORK

composer require flow-php/etl ~0.32.0

ChangelogRelease Cycle

play Try Playground

elephant
extract

Extracts

Read from various data sources.

arrow
transform

Transforms

Shape and optimize for your needs.

arrow
load

Loads

Store and secure in one of many available data sinks.

Examples:

Description

Type validation checks if a value matches the expected type without throwing exceptions. The isValid() method returns true if the value conforms to the type, false otherwise. This is useful for conditional logic, filtering data, or performing pre-flight checks before processing.

Unlike assertions, validation never throws - it's designed for control flow decisions rather than enforcing contracts.


Validate timezone values. Returns true for valid timezone identifier strings and DateTimeZone objects.

Documentation

Code

play
<?php

declare(strict_types=1);

use function Flow\Types\DSL\type_time_zone;

require __DIR__ . '/vendor/autoload.php';

echo 'Is "Europe/Warsaw" valid? ' . (type_time_zone()->isValid('Europe/Warsaw') ? 'yes' : 'no') . "\n";
echo 'Is "UTC" valid? ' . (type_time_zone()->isValid('UTC') ? 'yes' : 'no') . "\n";
echo 'Is "America/New_York" valid? ' . (type_time_zone()->isValid('America/New_York') ? 'yes' : 'no') . "\n";
echo 'Is "Invalid/Zone" valid? ' . (type_time_zone()->isValid('Invalid/Zone') ? 'yes' : 'no') . "\n";
echo 'Is DateTimeZone valid? ' . (type_time_zone()->isValid(new \DateTimeZone('UTC')) ? 'yes' : 'no') . "\n";

Contributors

Join us on GitHub external resource
scroll back to top