Skip to content

Commit 0e18bb8

Browse files
authored
Update README.md
1 parent c6373fc commit 0e18bb8

File tree

1 file changed

+10
-51
lines changed

1 file changed

+10
-51
lines changed

README.md

Lines changed: 10 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -17,57 +17,16 @@ Supported PHP versions: [![PHP 8.2](https://img.shields.io/badge/php-~8.2-8892BF
1717

1818
---
1919

20-
## Flow PHP
21-
22-
Flow is the most advanced PHP ETL (Extract, Transform, Load) framework.
23-
24-
```php
25-
<?php
26-
27-
declare(strict_types=1);
28-
29-
use function Flow\ETL\Adapter\Parquet\{from_parquet, to_parquet};
30-
use function Flow\ETL\DSL\{data_frame, lit, ref, sum, to_output, overwrite};
31-
use Flow\ETL\Filesystem\SaveMode;
32-
33-
require __DIR__ . '/vendor/autoload.php';
34-
35-
data_frame()
36-
->read(from_parquet(__DIR__ . '/orders_flow.parquet'))
37-
->select('created_at', 'total_price', 'discount')
38-
->withEntry('created_at', ref('created_at')->cast('date')->dateFormat('Y/m'))
39-
->withEntry('revenue', ref('total_price')->minus(ref('discount')))
40-
->select('created_at', 'revenue')
41-
->groupBy('created_at')
42-
->aggregate(sum(ref('revenue')))
43-
->sortBy(ref('created_at')->desc())
44-
->withEntry('daily_revenue', ref('revenue_sum')->round(lit(2))->numberFormat(lit(2)))
45-
->drop('revenue_sum')
46-
->write(to_output(truncate: false))
47-
->withEntry('created_at', ref('created_at')->toDate('Y/m'))
48-
->saveMode(overwrite())
49-
->write(to_parquet(__DIR__ . '/daily_revenue.parquet'))
50-
->run();
51-
```
52-
53-
```console
54-
$ php daily_revenue.php
55-
+------------+---------------+
56-
| created_at | daily_revenue |
57-
+------------+---------------+
58-
| 2023/10 | 206,669.74 |
59-
| 2023/09 | 227,647.47 |
60-
| 2023/08 | 237,027.31 |
61-
| 2023/07 | 240,111.05 |
62-
| 2023/06 | 225,536.35 |
63-
| 2023/05 | 234,624.74 |
64-
| 2023/04 | 231,472.05 |
65-
| 2023/03 | 231,697.36 |
66-
| 2023/02 | 211,048.97 |
67-
| 2023/01 | 225,539.81 |
68-
+------------+---------------+
69-
10 rows
70-
```
20+
## Usage Example
21+
22+
The most up-to-date examples are available at https://flow-php.com
23+
24+
- [DataFrame](https://flow-php.com/documentation/example/data_frame/data_frame/#example)
25+
- [Reading data from Array](https://flow-php.com/documentation/example/data_reading/array/#example)
26+
- [Reading data from CSV](https://flow-php.com/documentation/example/data_reading/csv/#example)
27+
- [Joins](https://flow-php.com/documentation/example/join/join/#example)
28+
- [Aggregatios](https://flow-php.com/documentation/example/aggregations/group_by/#example)
29+
- and many more...
7130

7231
## Community Contributions
7332

0 commit comments

Comments
 (0)