PHPackages                             xtompie/flux - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. xtompie/flux

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

xtompie/flux
============

Tool for managing events and logs. Collect, transform, stash with inputs, filters and outputs

1.4(1y ago)0691MITPHP

Since Jul 20Pushed 1y ago1 watchersCompare

[ Source](https://github.com/xtompie/flux)[ Packagist](https://packagist.org/packages/xtompie/flux)[ RSS](/packages/xtompie-flux/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (1)Versions (8)Used By (1)

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](#flux)
    - [Requirments](#requirments)
    - [Installation](#installation)
        - [Using skeleton](#using-skeleton)
    - [Docs](#docs)
        - [Machine](#machine)
        - [Program](#program)
        - [Start](#start)
        - [Input](#input)
        - [Filter](#filter)
        - [Output](#output)
        - [Stop](#stop)
        - [Finish](#finish)
        - [SetUp and TearDown](#setup-and-teardown)
        - [Built-in components](#built-in-components)
        - [Usage](#usage)
        - [Log monitor example](#log-monitor-example)
        - [Project tool example](#project-tool-example)

Requirments
-----------

[](#requirments)

- PHP &gt;= 8

Installation
------------

[](#installation)

### Using skeleton

[](#using-skeleton)

[xtompie/flux-skeleton](https://github.com/xtompie/flux-skeleton)

Docs
----

[](#docs)

### Machine

[](#machine)

Entrypoint of flux is `Machine`. Machine have programs and finishes.

### Program

[](#program)

Program has unique name, starts, inputs, filters, outputs, stops.

### Start

[](#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](https://github.com/xtompie/flux/blob/master/src/Core/Start.php)

### Input

[](#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](https://github.com/xtompie/flux/blob/master/src/Core/Input.php)

### Filter

[](#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](https://github.com/xtompie/flux/blob/master/src/Core/Filter.php)

### Output

[](#output)

Entry returned from filters is passed to each output. An example output can append the entry to file. See: [Output](https://github.com/xtompie/flux/blob/master/src/Core/Output.php)

### Stop

[](#stop)

Each stop is called at end of program. A clean up can be done in stop. See: [Stop](https://github.com/xtompie/flux/blob/master/src/Core/Stop.php)

### Finish

[](#finish)

Machine have finishse. Finishes are called after the desired program/programs are executed. It is similar to stop but for machine. See: [Finish](https://github.com/xtompie/flux/blob/master/src/Core/Finish.php)

### SetUp and TearDown

[](#setup-and-teardown)

Starts, inputs, filters, outputs and stops can implement [SetUp](https://github.com/xtompie/flux/blob/master/src/Core/SetUp.php), [TearDown](https://github.com/xtompie/flux/blob/master/src/Core/TearDown.php)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

[](#built-in-components)

- [Start](https://github.com/xtompie/flux/blob/master/src/Start)
- [Input](https://github.com/xtompie/flux/blob/master/src/Input)
- [Filter](https://github.com/xtompie/flux/blob/master/src/Filter)
- [Output](https://github.com/xtompie/flux/blob/master/src/Output)
- [Stop](https://github.com/xtompie/flux/blob/master/src/Stop)
- [Finish](https://github.com/xtompie/flux/blob/master/src/Finish)

### Usage

[](#usage)

`flux.php`:

```
