- Podman (preferred) or Docker — for running tests in containers
- Git — for version control
- VS Code with Dev Containers extension (optional) — for integrated dev environment
- No native PHP or Composer required on the host; everything runs in containers
If you have PHP 8.1+ and Composer installed locally, you can run tests directly. Otherwise, use the container commands below.
If you use VS Code with the Dev Containers extension, you can open this project in a fully configured development environment:
- Install the "Dev Containers" extension in VS Code
- Open the project folder in VS Code
- Click "Reopen in Container" when prompted (or press
F1→ "Dev Containers: Reopen")
This will start a PHP 8.3 CLI container for development. Use Terminal > New Termninal in VS Code to get a terminal running in the container.
composer installcomposer testBehat/Gherkin files are in features/.
composer test:bddcomposer analyse# Check formatting (detect violations)
composer format-check
# Fix formatting automatically
composer formatRun all quality checks (formatter, static analysis, tests) in one command:
composer checkgryphon-verified-client-ip.php Main plugin entry point
uninstall.php Cleanup on plugin deletion
src/
├── AdminPage.php Admin settings page UI
├── Diagnostics.php Request recording for debugging
├── HeaderParser.php RFC 7239 / XFF / single-value parsing
├── IpUtils.php CIDR matching, IPv4/IPv6 normalisation
├── Logger.php error_log wrapper with severity levels
├── Plugin.php WordPress lifecycle, IP resolution wiring
├── Resolver.php Core IP resolution algorithm
├── ResolverResult.php Resolution result data object
├── ResolverStep.php Step trace entry data object
├── Scheme.php Proxy scheme configuration data object
└── Settings.php Settings data model, persistence, validation
tests/
├── Unit/ Pure unit tests (no WordPress required)
│ ├── HeaderParserTest.php
│ ├── IpUtilsTest.php
│ ├── LoggerTest.php
│ ├── ResolverTest.php
│ └── SettingsTest.php
└── Integration/ Integration tests (WordPress stubs)
├── bootstrap.php WordPress function stubs
├── AdminPageTest.php
├── DiagnosticsTest.php
├── PluginTest.php
└── UninstallTest.php
examples/ Proxy chain configs for local testing
specifications/ Design documents
docs/ User and developer documentation
- WordPress loads
gryphon-verified-client-ip.phpatplugins_loadedpriority 0. Plugin::boot()creates the singleton and callsresolveClientIp().Settings::load()reads configuration fromwp_options.Resolver::resolve()walks the proxy chain using configured schemes.- If enabled and the IP changed,
$_SERVER['REMOTE_ADDR']is replaced. Diagnostics::maybeRecord()captures the request (if recording).- Admin UI is registered separately when
is_admin()is true.
- Unit tests mock
$_SERVERand test pure logic (Resolver, IpUtils, HeaderParser, Settings validation). No WordPress installation needed. - Integration tests use function stubs defined in
bootstrap.phpto simulate WordPress functions (get_option, apply_filters, etc.). - No WP_Mock dependency — stubs are simple
function_exists()guarded functions with$GLOBALSstorage.
The GitHub Actions workflow runs:
composer installcomposer test— PHPUnit testscomposer analyse— PHPStan static analysiscomposer format-check— PHPCS (WordPress Coding Standards) formatting check
All four must pass before merging.
For full end-to-end testing with WordPress and proxy chains, see the examples directory:
- examples/wp-client-ip/README.md — setup instructions for local proxy chain testing