Module Manager
The Module_Manager class provides a feature flag system for the Terra Framework. It lets you enable or disable optional framework features (like Grammar checking, Lighthouse monitoring, or the Schema Builder) on a per-project basis.
How It Works
Section titled โHow It WorksโThe Module Manager reads a configuration that defines which optional features are active. Framework code checks Module_Manager::is_active('feature_name') before initializing optional classes.
<?php// Inside functions.php, the Core class checks before instantiating optional modules:if (Module_Manager::is_active('grammar')) { new Grammar($config);}
if (Module_Manager::is_active('lighthouse')) { new TerraLighthouse($config);}Checking If a Module Is Active
Section titled โChecking If a Module Is ActiveโUse the static method anywhere in your code:
<?phpif (Module_Manager::is_active('schema_builder')) { // Schema builder is enabled for this project}Common Modules
Section titled โCommon Modulesโ| Module Key | Feature |
|---|---|
grammar | Grammar and spelling checker (uses OpenAI) |
lighthouse | Lighthouse performance monitoring |
schema_builder | JSON-LD schema builder |
csv_import | CSV import functionality |
google_search_console | GSC integration |
url_health_check | URL health monitoring |
Knowledge Check
Test your understanding of this section
Loading questions...