Skip to content

Commit d6df958

Browse files
author
flow-php
committed
1 parent eca5362 commit d6df958

178 files changed

Lines changed: 316 additions & 258 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

assets/manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,13 @@
147147
"wasm\/code.php.wasm": "\/assets\/wasm\/code.php-adea9d165ff134819809e92c908e0b90.wasm",
148148
"wasm\/data\/orders.csv": "\/assets\/wasm\/data\/orders-a23572d02c810fc9b709f09b0b8c92ef.csv",
149149
"wasm\/data\/orders.json": "\/assets\/wasm\/data\/orders-09429d88a4f65d938de30e5b8d9aa706.json",
150+
"wasm\/data\/orders.jsonl": "\/assets\/wasm\/data\/orders-3e60eb6ace02a2e0460d359280e24937.jsonl",
150151
"wasm\/data\/orders.parquet": "\/assets\/wasm\/data\/orders-e8777869fbcc2f3ff6a1471b5978db98.parquet",
151152
"wasm\/data\/orders.xml": "\/assets\/wasm\/data\/orders-8ee52a57261a7825213f3d66b9109591.xml",
152153
"wasm\/php.js": "\/assets\/wasm\/php-854edac03a51f967b58c16849625fb22.js",
153154
"wasm\/php.wasm": "\/assets\/wasm\/php-2c153f5537d6d5ef169b6c07f35bd236.wasm",
154155
"wasm\/phpcsfixer.php.wasm": "\/assets\/wasm\/phpcsfixer.php-65bf51f1ea90e4896971e11e62efef0b.wasm",
155-
"wasm\/tools\/flow.phar": "\/assets\/wasm\/tools\/flow-0933f89d617a71f10145ab57101bb927.phar",
156+
"wasm\/tools\/flow.phar": "\/assets\/wasm\/tools\/flow-d8440aee1b2e8e9da99853125714d2c3.phar",
156157
"wasm\/tools\/php-cs-fixer.phar": "\/assets\/wasm\/tools\/php-cs-fixer-de55dbd75a08d2eac0f0435d4168e6bc.phar",
157158
"wasm\/vendor\/autoload.php.wasm": "\/assets\/wasm\/vendor\/autoload.php-901f7714ee4a437fea3a9d6638722933.wasm"
158159
}

assets/wasm/data/orders-3e60eb6ace02a2e0460d359280e24937.jsonl

Lines changed: 100 additions & 0 deletions
Large diffs are not rendered by default.

assets/wasm/tools/flow-0933f89d617a71f10145ab57101bb927.phar renamed to assets/wasm/tools/flow-d8440aee1b2e8e9da99853125714d2c3.phar

3.17 MB
Binary file not shown.

data_frame/data_reading/database/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,12 @@ <h2 class="text-xl mt-5 mb-5" id="documentation">Code</h2><div id="code" class="
572572

573573
require __DIR__ . &#039;/vendor/autoload.php&#039;;
574574

575+
if (!\extension_loaded(&#039;pdo_sqlite&#039;)) {
576+
print &#039;Example skipped. Requires PDO SQLite extension which is not available in this environment.&#039; . PHP_EOL;
577+
578+
return;
579+
}
580+
575581
$connection = DriverManager::getConnection([
576582
&#039;path&#039; =&gt; __DIR__ . &#039;/input/orders.db&#039;,
577583
&#039;driver&#039; =&gt; &#039;pdo_sqlite&#039;,

data_frame/data_reading/json/index.html

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -566,22 +566,12 @@ <h2 class="text-xl mt-5 mb-5" id="documentation">Code</h2><div id="code" class="
566566
declare(strict_types=1);
567567

568568
use function Flow\ETL\Adapter\JSON\from_json;
569-
use function Flow\ETL\DSL\{bool_schema, data_frame, int_schema, schema, str_schema, to_output};
569+
use function Flow\ETL\DSL\{data_frame, to_output};
570570

571571
require __DIR__ . &#039;/vendor/autoload.php&#039;;
572572

573-
$schema = schema(
574-
int_schema(&#039;id&#039;),
575-
str_schema(&#039;name&#039;),
576-
str_schema(&#039;email&#039;),
577-
bool_schema(&#039;active&#039;),
578-
);
579-
580573
data_frame()
581-
-&gt;read(
582-
from_json(__DIR__ . &#039;/input/dataset.json&#039;)
583-
-&gt;withSchema($schema)
584-
)
574+
-&gt;read(from_json(__DIR__ . &#039;/data/orders.json&#039;))
585575
-&gt;collect()
586576
-&gt;write(to_output(truncate: false))
587577
-&gt;run();

data_frame/data_reading/jsonl/index.html

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -566,22 +566,12 @@ <h2 class="text-xl mt-5 mb-5" id="documentation">Code</h2><div id="code" class="
566566
declare(strict_types=1);
567567

568568
use function Flow\ETL\Adapter\JSON\from_json_lines;
569-
use function Flow\ETL\DSL\{bool_schema, data_frame, int_schema, schema, str_schema, to_output};
569+
use function Flow\ETL\DSL\{data_frame, to_output};
570570

571571
require __DIR__ . &#039;/vendor/autoload.php&#039;;
572572

573-
$schema = schema(
574-
int_schema(&#039;id&#039;),
575-
str_schema(&#039;name&#039;),
576-
str_schema(&#039;email&#039;),
577-
bool_schema(&#039;active&#039;),
578-
);
579-
580573
data_frame()
581-
-&gt;read(
582-
from_json_lines(__DIR__ . &#039;/input/dataset.jsonl&#039;)
583-
-&gt;withSchema($schema)
584-
)
574+
-&gt;read(from_json_lines(__DIR__ . &#039;/data/orders.jsonl&#039;))
585575
-&gt;collect()
586576
-&gt;write(to_output(truncate: false))
587577
-&gt;run();

documentation/components/adapters/json/index.html

Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -509,57 +509,48 @@ <h2><a id="installation" href="#installation" class="mr-2" aria-hidden="true" ti
509509
<h2><a id="extractor---jsonmachine---jsonextractor" href="#extractor---jsonmachine---jsonextractor" class="mr-2" aria-hidden="true" title="Permalink">#</a>Extractor - JSONMachine - JsonExtractor</h2>
510510
<pre class="language-php" data-controller="syntax-highlight"><code class="language-php">&lt;?php
511511

512-
use Flow\ETL\Adapter\JSON\JSONMachine\JsonExtractor;
512+
use function Flow\ETL\Adapter\JSON\from_json;
513+
use function Flow\ETL\DSL\{data_frame, to_output};
513514

514-
$rows = (new Flow())
515-
-&gt;read(from_json(__DIR__ . '/../Fixtures/timezones.json', 5))
516-
-&gt;fetch()
515+
data_frame()
516+
-&gt;read(from_json(__DIR__ . '/data.json'))
517+
-&gt;collect()
518+
-&gt;write(to_output())
519+
-&gt;run();
517520
</code></pre>
518521
<h2><a id="loader---jsonloader" href="#loader---jsonloader" class="mr-2" aria-hidden="true" title="Permalink">#</a>Loader - JsonLoader</h2>
519522
<pre class="language-php" data-controller="syntax-highlight"><code class="language-php">&lt;?php
520523

521-
use function Flow\ETL\Adapter\JSON\{to_json};
522-
use Flow\ETL\Flow;
523-
use Flow\ETL\Row;
524-
use Flow\ETL\Rows;
525-
526-
(new Flow())
527-
-&gt;process(
528-
new Rows(
529-
...\array_map(
530-
fn (int $i) : Row =&gt; Row::create(
531-
new Row\Entry\IntegerEntry('id', $i),
532-
new Row\Entry\StringEntry('name', 'name_' . $i)
533-
),
534-
\range(0, 10)
535-
)
524+
use function Flow\ETL\Adapter\JSON\to_json;
525+
use function Flow\ETL\DSL\{data_frame, from_array};
526+
527+
data_frame()
528+
-&gt;read(from_array(
529+
\array_map(
530+
fn (int $i) : array =&gt; ['id' =&gt; $i, 'name' =&gt; 'name_' . $i],
531+
\range(0, 10)
536532
)
537-
)
533+
))
534+
-&gt;collect()
538535
-&gt;write(to_json(\sys_get_temp_dir() . '/file.json'))
539536
-&gt;run();
540537
</code></pre>
541538
<h2><a id="loader---jsonloader---json-lines" href="#loader---jsonloader---json-lines" class="mr-2" aria-hidden="true" title="Permalink">#</a>Loader - JsonLoader - JSON lines</h2>
542539
<p>It is also possible to export the rows using the <a rel="noopener noreferrer" target="_blank" href="https://jsonlines.org/">json lines</a> format</p>
543540
<pre class="language-php" data-controller="syntax-highlight"><code class="language-php">&lt;?php
544541

545-
use function Flow\ETL\Adapter\JSON\{to_json};
546-
use Flow\ETL\Flow;
547-
use Flow\ETL\Row;
548-
use Flow\ETL\Rows;
549-
550-
(new Flow())
551-
-&gt;process(
552-
new Rows(
553-
...\array_map(
554-
fn (int $i) : Row =&gt; Row::create(
555-
new Row\Entry\IntegerEntry('id', $i),
556-
new Row\Entry\StringEntry('name', 'name_' . $i)
557-
),
558-
\range(0, 10)
559-
)
542+
use function Flow\ETL\Adapter\JSON\to_json_lines;
543+
use function Flow\ETL\DSL\{data_frame, from_array};
544+
545+
data_frame()
546+
-&gt;read(from_array(
547+
\array_map(
548+
fn (int $i) : array =&gt; ['id' =&gt; $i, 'name' =&gt; 'name_' . $i],
549+
\range(0, 10)
560550
)
561-
)
562-
-&gt;write(to_json(\sys_get_temp_dir() . '/file.jsonl')-&gt;asJsonl())
551+
))
552+
-&gt;collect()
553+
-&gt;write(to_json_lines(\sys_get_temp_dir() . '/file.jsonl'))
563554
-&gt;run();
564555
</code></pre>
565556

documentation/dsl/json/from-json-lines/index.html

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -558,22 +558,12 @@ <h4 class="text-bold mt-5 mb-5">Example: <a href="/data_frame/data_reading/#exam
558558
declare(strict_types=1);
559559

560560
use function Flow\ETL\Adapter\JSON\from_json_lines;
561-
use function Flow\ETL\DSL\{bool_schema, data_frame, int_schema, schema, str_schema, to_output};
561+
use function Flow\ETL\DSL\{data_frame, to_output};
562562

563563
require __DIR__ . &#039;/vendor/autoload.php&#039;;
564564

565-
$schema = schema(
566-
int_schema(&#039;id&#039;),
567-
str_schema(&#039;name&#039;),
568-
str_schema(&#039;email&#039;),
569-
bool_schema(&#039;active&#039;),
570-
);
571-
572565
data_frame()
573-
-&gt;read(
574-
from_json_lines(__DIR__ . &#039;/input/dataset.jsonl&#039;)
575-
-&gt;withSchema($schema)
576-
)
566+
-&gt;read(from_json_lines(__DIR__ . &#039;/data/orders.jsonl&#039;))
577567
-&gt;collect()
578568
-&gt;write(to_output(truncate: false))
579569
-&gt;run();

documentation/dsl/json/from-json/index.html

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -558,22 +558,12 @@ <h4 class="text-bold mt-5 mb-5">Example: <a href="/data_frame/data_reading/#exam
558558
declare(strict_types=1);
559559

560560
use function Flow\ETL\Adapter\JSON\from_json;
561-
use function Flow\ETL\DSL\{bool_schema, data_frame, int_schema, schema, str_schema, to_output};
561+
use function Flow\ETL\DSL\{data_frame, to_output};
562562

563563
require __DIR__ . &#039;/vendor/autoload.php&#039;;
564564

565-
$schema = schema(
566-
int_schema(&#039;id&#039;),
567-
str_schema(&#039;name&#039;),
568-
str_schema(&#039;email&#039;),
569-
bool_schema(&#039;active&#039;),
570-
);
571-
572565
data_frame()
573-
-&gt;read(
574-
from_json(__DIR__ . &#039;/input/dataset.json&#039;)
575-
-&gt;withSchema($schema)
576-
)
566+
-&gt;read(from_json(__DIR__ . &#039;/data/orders.json&#039;))
577567
-&gt;collect()
578568
-&gt;write(to_output(truncate: false))
579569
-&gt;run();

playground/aggregations/aggregating_functions/average/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@
321321
data-playground-share-is-example-value="true"
322322
data-wasm-php-js-value="/assets/wasm/php-854edac03a51f967b58c16849625fb22.js"
323323
data-wasm-php-wasm-value="/assets/wasm/php-2c153f5537d6d5ef169b6c07f35bd236.wasm"
324-
data-wasm-resources-value="{&quot;code.php&quot;:&quot;\/assets\/wasm\/code.php-adea9d165ff134819809e92c908e0b90.wasm&quot;,&quot;tools\/flow.phar&quot;:&quot;\/assets\/wasm\/tools\/flow-0933f89d617a71f10145ab57101bb927.phar&quot;,&quot;tools\/php-cs-fixer.phar&quot;:&quot;\/assets\/wasm\/tools\/php-cs-fixer-de55dbd75a08d2eac0f0435d4168e6bc.phar&quot;,&quot;vendor\/autoload.php&quot;:&quot;\/assets\/wasm\/vendor\/autoload.php-901f7714ee4a437fea3a9d6638722933.wasm&quot;,&quot;.php-cs-fixer.php&quot;:&quot;\/assets\/wasm\/phpcsfixer.php-65bf51f1ea90e4896971e11e62efef0b.wasm&quot;,&quot;bin\/cs-fixer.php&quot;:&quot;\/assets\/wasm\/bin\/cs-fixer.php-ac4974a6fd6684a03a024047ab1f831c.wasm&quot;,&quot;data\/orders.xml&quot;:&quot;\/assets\/wasm\/data\/orders-8ee52a57261a7825213f3d66b9109591.xml&quot;,&quot;data\/orders.json&quot;:&quot;\/assets\/wasm\/data\/orders-09429d88a4f65d938de30e5b8d9aa706.json&quot;,&quot;data\/orders.csv&quot;:&quot;\/assets\/wasm\/data\/orders-a23572d02c810fc9b709f09b0b8c92ef.csv&quot;,&quot;data\/orders.parquet&quot;:&quot;\/assets\/wasm\/data\/orders-e8777869fbcc2f3ff6a1471b5978db98.parquet&quot;}"
324+
data-wasm-resources-value="{&quot;code.php&quot;:&quot;\/assets\/wasm\/code.php-adea9d165ff134819809e92c908e0b90.wasm&quot;,&quot;tools\/flow.phar&quot;:&quot;\/assets\/wasm\/tools\/flow-d8440aee1b2e8e9da99853125714d2c3.phar&quot;,&quot;tools\/php-cs-fixer.phar&quot;:&quot;\/assets\/wasm\/tools\/php-cs-fixer-de55dbd75a08d2eac0f0435d4168e6bc.phar&quot;,&quot;vendor\/autoload.php&quot;:&quot;\/assets\/wasm\/vendor\/autoload.php-901f7714ee4a437fea3a9d6638722933.wasm&quot;,&quot;.php-cs-fixer.php&quot;:&quot;\/assets\/wasm\/phpcsfixer.php-65bf51f1ea90e4896971e11e62efef0b.wasm&quot;,&quot;bin\/cs-fixer.php&quot;:&quot;\/assets\/wasm\/bin\/cs-fixer.php-ac4974a6fd6684a03a024047ab1f831c.wasm&quot;,&quot;data\/orders.xml&quot;:&quot;\/assets\/wasm\/data\/orders-8ee52a57261a7825213f3d66b9109591.xml&quot;,&quot;data\/orders.json&quot;:&quot;\/assets\/wasm\/data\/orders-09429d88a4f65d938de30e5b8d9aa706.json&quot;,&quot;data\/orders.csv&quot;:&quot;\/assets\/wasm\/data\/orders-a23572d02c810fc9b709f09b0b8c92ef.csv&quot;,&quot;data\/orders.jsonl&quot;:&quot;\/assets\/wasm\/data\/orders-3e60eb6ace02a2e0460d359280e24937.jsonl&quot;,&quot;data\/orders.parquet&quot;:&quot;\/assets\/wasm\/data\/orders-e8777869fbcc2f3ff6a1471b5978db98.parquet&quot;}"
325325
data-playground-package-icon-value="/assets/images/icons/package-30016a0b8b16a09f8bd0e0c19768ce6e.svg"
326326
data-playground-link-icon-value="/assets/images/icons/link-dd3acd183ca5fd1d06ddf52b258a2359.svg"
327327
data-playground-example-icon-value="/assets/images/icons/flow-cafc61a123235340b0846daa351952ee.svg"

0 commit comments

Comments
 (0)