Skip to content

Commit

Permalink
NEW: Added support for config condition if PHP extension is loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
UndefinedOffset committed Jul 2, 2019
1 parent 0daed7b commit 571a4d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Expand Up @@ -339,6 +339,7 @@ You then list any of the following rules as sub-keys, with informational values
- 'envvarset', in which case the value(s) should be environment variables that must be set
- 'constantdefined', in which case the value(s) should be constants that must be defined
- 'envorconstant' A variable which should be defined either via environment vars or constants
- 'extensionloaded', in which case the PHP extension(s) must be loaded

For instance, to add a property to "foo" when a module exists, and "bar" otherwise, you could do this:

Expand Down
3 changes: 3 additions & 0 deletions src/Core/Config/CoreConfigFactory.php
Expand Up @@ -182,6 +182,9 @@ function ($name, $value = null) use ($envvarset, $constantdefined) {
})
->addRule('moduleexists', function ($module) {
return ModuleLoader::inst()->getManifest()->moduleExists($module);
})
->addRule('extensionloaded', function ($extension) {
return extension_loaded($extension);
});
}
}

0 comments on commit 571a4d9

Please sign in to comment.