Download the PHP package xtompie/flux without Composer
On this page you can find all versions of the php package xtompie/flux. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package flux
flux
Event and Log Management Tool. Data processing pipeline created in PHP. Efficiently collect, parse, and transform logs. Highly customizable and extensible for your needs.
- flux
- Requirments
- Installation
- Using skeleton
- Docs
- Machine
- Program
- Start
- Input
- Filter
- Output
- Stop
- Finish
- SetUp and TearDown
- Built-in components
- Usage
- Log monitor example
- Project tool example
Requirments
- PHP >= 8
Installation
Using skeleton
Docs
Machine
Entrypoint of flux is Machine
.
Machine have programs and finishes.
Program
Program has unique name, starts, inputs, filters, outputs, stops.
Start
Each starts is called at beging of program. They are designed to prepare data. An example of start can be a rsync which will download data from an external server to a local folder or unpack an archive. See: Start
Input
Next each input is called. Input generates a entry of type string. Each generated entry is individually and immediately passed to filters. An example input can be a generator that generates an entry from each line of file. See: Input
Filter
Entry is passed into each filter. Filter can modify the entry. Filter can return null then the entry will not be further processed. See: Filter
Output
Entry returned from filters is passed to each output. An example output can append the entry to file. See: Output
Stop
Each stop is called at end of program. A clean up can be done in stop. See: Stop
Finish
Machine have finishse. Finishes are called after the desired program/programs are executed. It is similar to stop but for machine. See: Finish
SetUp and TearDown
Starts, inputs, filters, outputs and stops can implement SetUp, TearDown interfaces.
SetUp is used at the beginning of program startup before starts are called.
TearDown is used at the end of program execution after each stop is called.
Built-in components
Usage
flux.php
:
Then in shell php flux.php runall
.
Programs can be run by:
Machine->runAllPrograms()
Machine->runProgram(string $name)
Machine->run
- then machine reads shell argumentsrunall
- runs all programs e.g.php flux.php runall
run <program-name>
- run prgoram by name e.g.php flux.php run default
Log monitor example
Application that will collect logs from many application or serwers.
flux.php
:
Then in shell php flux.php runall
.
With OnceFilter
the log/
directory will bahave like inbox.
Only new entries will be stored in log/
.
Entries from log/
can be manually deleted.
CountFilesLinesFinish
will tell how meany new entries are in log/
.
Project tool example
Tool in project that will help track application error from test and prod server.
Create folder tools/log
in project root directory.
cd tools/log
.
composer require xtompie/flux
This will output:
No composer.json in current directory, do you want to use the one at ../../? [Y,n]? Type
n
. This should createcomposer.json
,composer.lock
andvendor
. Create.gitignore
with contents:
Create flux.php
and modify it for your needs:
Then in project root directory in composer.json
add scripts:
Now from your project root directory with composer log-dev
u can easily fetch new error logs.