Ops And Release

AIWAF-PHP Operations

Source and package versions

One AIWAF repository. Python: py/aiwaf/ · Node.js: js/ · Rust/WASM: rust/ · Java: java/. Source and canonical README. Versions shown describe the source checkout; package releases are independent. Current Python/Node source targets are aiwaf 1.1.8 (Python) and aiwaf 1.1.5 (npm), with Rust/Python 0.2.7 and WASM 0.2.5 and Java 1.3.5. Sandbox guides retain their separately pinned builds.

10. Operational Command Surface

php setup.php
php cli/detect_and_train.php
composer test
composer run cover-everything
composer run test-adapters-matrix
composer run validate-all

AIWAF-PHP operations are script-based (PHP/Composer), not a Node-style monolithic CLI.

11. Configuration Model

Layering

  1. Defaults in Core\RuntimeConfig
  2. Optional JSON file via RuntimeConfig::loadFromFile
  3. Environment mapping via RuntimeConfig::loadFromEnvironment
  4. Runtime overrides via RuntimeConfig::update

Static Config Highlights (Config)

  • Config::$exemptPaths, Config::$knownPaths
  • Config::$rateLimitPerMinute
  • Config::$keywordDetectionThreshold
  • Config::$uuidTamperThreshold
  • Config::$aiAnomalyThreshold
  • Config::HEADER_MIN_SCORE, Config::REQUIRED_HEADERS

Env Mapping Highlights

  • Storage, header validation, rate limiting, detection toggles, geo policies, blocklist/logging controls.

12. Request Lifecycle (Simplified)

  1. Request enters front controller/bootstrap.
  2. AIWAF::protect() evaluates exemptions and enabled controls.
  3. Failing controls block with 403/429 and may persist IP consequences.
  4. Passing requests continue to app routing.
  5. Training loop independently updates model and keywords from historical logs.

13. Testing And Local Development

  • PHP >=7.4, Composer, optional Docker for adapter/sandbox matrix workflows.
composer install
php setup.php
composer test
php cli/detect_and_train.php
composer run cover-everything
composer run test-adapters-matrix
composer run validate-all

14. Packaging And Release Surface

  • Composer name: aayushgauba/aiwaf
  • PSR-4 namespace: AIWAF\\ -> src/
  • Dev namespace: AIWAF\\Tests\\ -> tests/
  • Archive excludes include /examples and /tools

15. Operational Notes

  • Run AIWAF::protect() early, before side effects/output.
  • Keep exemptions explicit for health checks and trusted callbacks.
  • Treat anomaly blocking as data-dependent and retrain with representative logs.
  • Select adapter/driver backend according to deployment topology and durability needs.
  • Validate thresholds/settings with staged traffic before tightening.

Suggested Onboarding Order

  1. README.md
  2. docs/php/setup (Setup Guide)
  3. src/AIWAF.php
  4. src/Core/RuntimeConfig.php
  5. src/Core/Training.php and src/Core/TrainingLogic.php
  6. src/Adapters/* and src/RateLimit/*
  7. cli/detect_and_train.php
  8. tests/