@@ -10,16 +10,20 @@ and you're looking for a PHP library to do the stuff.
10
10
11
11
Alright, let's go!
12
12
13
+ ` bentools-etl ` is a versatile PHP library for implementing the Extract, Transform, Load (ETL) pattern, designed to streamline data processing tasks.
14
+
13
15
Installation
14
16
------------
15
17
16
18
``` bash
17
19
composer require bentools/etl:^4.0@alpha
18
20
```
19
21
20
- _ Warning: version 4.0 is a complete rewrite and a involves important BC breaks._
22
+ > ** Warning #1 ** : Version 4.0 is a complete rewrite and introduces significant BC (backward compatibility) breaks.
23
+ > Avoid upgrading from ` ^2.0 ` or ` ^3.0 ` unless you're fully aware of the changes.
24
+
25
+ > ** Warning #2 ** : Version 4.0 is still at an alpha stage. BC breaks might occur between alpha releases.
21
26
22
- _ Don't upgrade from ` ^2.0 ` or ` ^3.0 ` unless you know what you're doing!_
23
27
24
28
Usage
25
29
-----
@@ -34,16 +38,22 @@ Now let's have a look on how simple it is:
34
38
``` php
35
39
use BenTools\ETL\EtlExecutor;
36
40
41
+ // Given
42
+ $singers = ['Bob Marley', 'Amy Winehouse'];
43
+
44
+ // Transform each singer's name to uppercase and process the array
37
45
$etl = (new EtlExecutor())
38
46
->transformWith(fn (string $name) => strtoupper($name));
39
47
40
- $singers = ['Bob Marley', 'Amy Winehouse'];
48
+ // When
41
49
$report = $etl->process($singers);
42
- dump($report->output); // ["BOB MARLEY", "AMY WINEHOUSE"]
50
+
51
+ // Then
52
+ var_dump($report->output); // ["BOB MARLEY", "AMY WINEHOUSE"]
43
53
```
44
54
45
- OK, that wasn't really hard, here we basically don't have to extract anything (we can already iterate on ` $singers ` ),
46
- and we're not loading anywhere, except into PHP's memory.
55
+ OK, that wasn't really hard, here we basically don't have to _ extract _ anything (we can already iterate on ` $singers ` ),
56
+ and we're not _ loading _ anywhere, except into PHP's memory.
47
57
48
58
Now let's take this to the next level:
49
59
@@ -99,7 +109,8 @@ The `CSVExtractor` has some options to _read_ the data, such as considering that
99
109
Creating your own Extractor / Transformers / Loaders
100
110
--------------------------------------------------
101
111
102
- You can implement ` ExtractorInterface ` , ` TransformerInterface ` and ` LoaderInterface ` , or basically use simple ` callable ` with the same signatures.
112
+ You can implement ` ExtractorInterface ` , ` TransformerInterface ` , and ` LoaderInterface ` .
113
+ Alternatively, use simple ` callable ` functions with the same signatures.
103
114
104
115
Here's another example:
105
116
``` php
@@ -151,7 +162,8 @@ But the last transformer of the chain (or your only one transformer) is determin
151
162
Using events
152
163
------------
153
164
154
- The ` EtlExecutor ` emits various events during the workflow:
165
+ The ` EtlExecutor ` emits a variety of events during the ETL workflow, providing insights and control over the process.
166
+
155
167
- ` InitEvent ` when ` process() ` was just called
156
168
- ` StartEvent ` when extraction just started (we might know the total number of items to extract at this time, if the extractor provides this)
157
169
- ` ExtractEvent ` upon each extracted item
@@ -197,7 +209,7 @@ Flush frequency and early flushes
197
209
By default, the ` flush() ` method of your loader will be invoked at the end of the ETL,
198
210
meaning it will likely keep all loaded items in memory before dumping them to their final destination.
199
211
200
- Feel free to adjust a ` flushFrequency ` that fits your needs
212
+ Feel free to adjust a ` flushFrequency ` that fits your needs to manage memory usage and data processing efficiency
201
213
and optionally trigger an early flush at any time during the ETL process:
202
214
203
215
``` php
@@ -237,8 +249,8 @@ $etl = $etl->onLoad(function (LoadEvent $event) {
237
249
Recipes
238
250
-------
239
251
240
- Recipes are reusable configurations of an ` EtlExecutor ` .
241
- For example, to enable logging, use the ` LoggerRecipe ` :
252
+ Recipes are pre-configured setups for ` EtlExecutor ` , facilitating reusable ETL configurations.
253
+ For instance, ` LoggerRecipe ` enables logging for all ETL events.
242
254
243
255
``` php
244
256
use BenTools\ETL\EtlExecutor;
@@ -321,7 +333,7 @@ Contribute
321
333
----------
322
334
323
335
Contributions are welcome!
324
- Before sending your PRs, run this command to ensure test pass and 100% of the code is covered .
336
+ Please ensure to run tests using the command below and maintain 100% code coverage before submitting PRs .
325
337
326
338
``` bash
327
339
composer ci:check
0 commit comments