Skip to content
Greg Bowler edited this page May 9, 2026 · 3 revisions
  • Explain hidden coupling and unpredictable state.
  • Explain the security and maintainability issues of raw superglobals.

Protected global variables in WebEngine

  • Cover $_GET, $_POST, $_FILES, $_COOKIE, $_SERVER, and related global state.
  • Explain the framework’s object-oriented replacements.

Encapsulation

  • Encourage explicit dependencies through services and parameters.
  • Explain why this improves testability.
  • Explain the term "encapsulation" and the benefits it brings to code.

When global state is still necessary

  • Environment variables.
  • PHP runtime behaviour.
  • Third-party libraries that assume globals. Exaplin how to whitelist or reconstruct.

In the next section we will learn how to build API responses.

Clone this wiki locally