# synacktiv/php_filter_chain_generator architecture

> Architecture diagram of the GitHub repository synacktiv/php_filter_chain_generator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/synacktiv/php_filter_chain_generator
- Repository: https://github.com/synacktiv/php_filter_chain_generator

## Overview

A small Python CLI that turns supplied content (or raw base64 for debugging) into a PHP stream-filter chain. The README documents its use for PHP include/require contexts; the repository contains only the generator script, so the target PHP application and execution are external. Architecture is based on the README and the single sampled source file.

Main entry points: [`php_filter_chain_generator.py`](https://github.com/synacktiv/php_filter_chain_generator/blob/main/php_filter_chain_generator.py) (Argument parsing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI generation"]
  node_args["Argument parsing"]
  node_content["Content input"]
  node_base64["Base64 preparation"]
  node_validator["Raw base64 validation"]
  node_output["Chain output"]
end

subgraph group_chain["Filter construction"]
  node_mapping["Character conversions"]
  node_builder["Filter chain builder"]
end

node_user(("CLI user"))
node_php(("PHP include/require"))

node_user -->|"provides options"| node_args
node_args -->|"selects chain"| node_content
node_content -->|"encodes content"| node_base64
node_args -->|"selects raw input"| node_validator
node_base64 -->|"generates chain"| node_builder
node_validator -->|"validates then builds"| node_builder
node_builder -->|"looks up conversions"| node_mapping
node_args -->|"prints result"| node_output
node_builder -->|"returns filter URI"| node_output
node_output -.->|"supplies URI"| node_php

click node_args "https://github.com/synacktiv/php_filter_chain_generator/blob/main/php_filter_chain_generator.py"
click node_content "https://github.com/synacktiv/php_filter_chain_generator/blob/main/php_filter_chain_generator.py"
click node_base64 "https://github.com/synacktiv/php_filter_chain_generator/blob/main/php_filter_chain_generator.py"
click node_validator "https://github.com/synacktiv/php_filter_chain_generator/blob/main/php_filter_chain_generator.py"
click node_mapping "https://github.com/synacktiv/php_filter_chain_generator/blob/main/php_filter_chain_generator.py"
click node_builder "https://github.com/synacktiv/php_filter_chain_generator/blob/main/php_filter_chain_generator.py"
click node_output "https://github.com/synacktiv/php_filter_chain_generator/blob/main/php_filter_chain_generator.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_args,node_content,node_base64,node_validator,node_output,node_user toneBlue
class node_mapping,node_builder toneAmber
class node_php toneIndigo
```

## Components

### CLI generation

- [Argument parsing](https://github.com/synacktiv/php_filter_chain_generator/blob/main/php_filter_chain_generator.py): `php_filter_chain_generator.py`
- [Content input](https://github.com/synacktiv/php_filter_chain_generator/blob/main/php_filter_chain_generator.py): `php_filter_chain_generator.py`
- [Base64 preparation](https://github.com/synacktiv/php_filter_chain_generator/blob/main/php_filter_chain_generator.py): `php_filter_chain_generator.py`
- [Raw base64 validation](https://github.com/synacktiv/php_filter_chain_generator/blob/main/php_filter_chain_generator.py): `php_filter_chain_generator.py`
- [Chain output](https://github.com/synacktiv/php_filter_chain_generator/blob/main/php_filter_chain_generator.py): `php_filter_chain_generator.py`

### Filter construction

- [Character conversions](https://github.com/synacktiv/php_filter_chain_generator/blob/main/php_filter_chain_generator.py): `php_filter_chain_generator.py`
- [Filter chain builder](https://github.com/synacktiv/php_filter_chain_generator/blob/main/php_filter_chain_generator.py): `php_filter_chain_generator.py`

### Other components

- **CLI user**
- **PHP include/require**

## Connections

- CLI user → Argument parsing: provides options
- Argument parsing → Content input: selects chain
- Content input → Base64 preparation: encodes content
- Argument parsing → Raw base64 validation: selects raw input
- Base64 preparation → Filter chain builder: generates chain
- Raw base64 validation → Filter chain builder: validates then builds
- Filter chain builder → Character conversions: looks up conversions
- Argument parsing → Chain output: prints result
- Filter chain builder → Chain output: returns filter URI
- Chain output → PHP include/require: supplies URI
