# speedupmate/magento2-spmt-fast-di-compile architecture

> Architecture diagram of the GitHub repository speedupmate/magento2-spmt-fast-di-compile, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/speedupmate/magento2-spmt-fast-di-compile
- Repository: https://github.com/speedupmate/magento2-spmt-fast-di-compile

## Overview

This Magento companion module preserves the `setup:di:compile` CLI entry point while selecting a trusted local Rust compiler when available, with standard PHP compilation as an explicit or automatic fallback. Its separate installer fetches and verifies a platform release binary. The graph reflects the README and shown source; Magento DI wiring and several installer internals are not fully sampled, so those links rely on documented behavior rather than inspected implementation details.

Main entry points: [`src/Console/Command/FastDiCompileCommand.php`](https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/src/Console/Command/FastDiCompileCommand.php) (Compile wrapper), [`src/Console/CommandLoader/AggregateInterceptor.php`](https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/src/Console/CommandLoader/AggregateInterceptor.php) (Command loader interceptor), [`bin/install-fast-di-compile.php`](https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/bin/install-fast-di-compile.php) (Release installer), [`src/registration.php`](https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/src/registration.php) (Module registration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_module["Magento integration"]
  node_registration["Module registration<br/>[registration.php]"]
  node_di_config["DI preference<br/>[di.xml]"]
  node_aggregate["Command loader interceptor"]
  node_trusted_binary["Trusted binary selection"]
end

subgraph group_compile["Compile command"]
  node_wrapper["Compile wrapper"]
  node_rust_compiler["Rust DI compiler"]
  node_php_compile["Standard PHP compiler"]
  node_options["Option validation and forwarding"]
  node_root_safety["Root-path and environment safeguards"]
  node_compile_output["Sanitized compile output"]
end

subgraph group_installer["Binary installation"]
  node_installer["Release installer"]
end

node_admin(("Magento operator"))
node_magento["Magento CLI"]
node_github["GitHub release assets"]
node_installed_binary["Installed compiler binary"]

node_admin -->|"runs command"| node_magento
node_magento -.->|"loads command"| node_aggregate
node_di_config -->|"registers preference"| node_aggregate
node_aggregate -->|"checks binary"| node_trusted_binary
node_trusted_binary -->|"selects wrapper"| node_wrapper
node_aggregate -->|"returns original"| node_php_compile
node_wrapper -->|"validates and forwards"| node_options
node_wrapper -->|"checks paths"| node_root_safety
node_wrapper -->|"runs process"| node_rust_compiler
node_wrapper -->|"runs on standard"| node_php_compile
node_rust_compiler -.->|"produces output"| node_compile_output
node_wrapper -->|"sanitizes output"| node_compile_output
node_admin -->|"invokes installer"| node_installer
node_installer -->|"downloads release"| node_github
node_installer -->|"installs verified binary"| node_installed_binary
node_installed_binary -.->|"candidate for use"| node_trusted_binary
node_registration -->|"registers module"| node_magento

click node_registration "https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/src/registration.php"
click node_di_config "https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/src/etc/di.xml"
click node_aggregate "https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/src/Console/CommandLoader/AggregateInterceptor.php"
click node_trusted_binary "https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/src/Console/CommandLoader/AggregateInterceptor.php"
click node_wrapper "https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/src/Console/Command/FastDiCompileCommand.php"
click node_options "https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/src/Console/Command/FastDiCompileCommand.php"
click node_root_safety "https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/src/Console/Command/FastDiCompileCommand.php"
click node_compile_output "https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/src/Console/Command/FastDiCompileCommand.php"
click node_installer "https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/bin/install-fast-di-compile.php"

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_registration,node_di_config,node_aggregate,node_trusted_binary toneBlue
class node_wrapper,node_rust_compiler,node_php_compile,node_options,node_root_safety,node_compile_output toneAmber
class node_installer toneMint
class node_admin,node_magento,node_github,node_installed_binary toneIndigo
```

## Components

### Magento integration

- [Module registration](https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/src/registration.php): `src/registration.php`
- [DI preference](https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/src/etc/di.xml): `src/etc/di.xml`
- [Command loader interceptor](https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/src/Console/CommandLoader/AggregateInterceptor.php): `src/Console/CommandLoader/AggregateInterceptor.php`
- [Trusted binary selection](https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/src/Console/CommandLoader/AggregateInterceptor.php): `src/Console/CommandLoader/AggregateInterceptor.php`

### Compile command

- [Compile wrapper](https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/src/Console/Command/FastDiCompileCommand.php): `src/Console/Command/FastDiCompileCommand.php`
- **Rust DI compiler**
- **Standard PHP compiler**
- [Option validation and forwarding](https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/src/Console/Command/FastDiCompileCommand.php): `src/Console/Command/FastDiCompileCommand.php`
- [Root-path and environment safeguards](https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/src/Console/Command/FastDiCompileCommand.php): `src/Console/Command/FastDiCompileCommand.php`
- [Sanitized compile output](https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/src/Console/Command/FastDiCompileCommand.php): `src/Console/Command/FastDiCompileCommand.php`

### Binary installation

- [Release installer](https://github.com/speedupmate/magento2-spmt-fast-di-compile/blob/main/bin/install-fast-di-compile.php): `bin/install-fast-di-compile.php`

### Other components

- **Magento operator**
- **Magento CLI**
- **GitHub release assets**
- **Installed compiler binary**

## Connections

- Magento operator → Magento CLI: runs command (evidence: `README.md`)
- Magento CLI → Command loader interceptor: loads command (evidence: `README.md`)
- DI preference → Command loader interceptor: registers preference (evidence: `README.md`)
- Command loader interceptor → Trusted binary selection: checks binary (evidence: `src/Console/CommandLoader/AggregateInterceptor.php`)
- Trusted binary selection → Compile wrapper: selects wrapper (evidence: `src/Console/CommandLoader/AggregateInterceptor.php`)
- Command loader interceptor → Standard PHP compiler: returns original (evidence: `src/Console/CommandLoader/AggregateInterceptor.php`)
- Compile wrapper → Option validation and forwarding: validates and forwards (evidence: `src/Console/Command/FastDiCompileCommand.php`)
- Compile wrapper → Root-path and environment safeguards: checks paths (evidence: `src/Console/Command/FastDiCompileCommand.php`)
- Compile wrapper → Rust DI compiler: runs process (evidence: `README.md`)
- Compile wrapper → Standard PHP compiler: runs on standard (evidence: `src/Console/Command/FastDiCompileCommand.php`)
- Rust DI compiler → Sanitized compile output: produces output (evidence: `README.md`)
- Compile wrapper → Sanitized compile output: sanitizes output (evidence: `src/Console/Command/FastDiCompileCommand.php`)
- Magento operator → Release installer: invokes installer (evidence: `README.md`)
- Release installer → GitHub release assets: downloads release (evidence: `README.md`)
- Release installer → Installed compiler binary: installs verified binary (evidence: `bin/install-fast-di-compile.php`)
- Installed compiler binary → Trusted binary selection: candidate for use (evidence: `README.md`)
- Module registration → Magento CLI: registers module (evidence: `src/registration.php`)
