# Constraints
For more information on Constraints see Features - Constraints and Actions - Constraints
If your Feature or Action has Constraints to declare, then you must add the following to your class:
protected function constraints(\Lantern\Features\ConstraintsBuilder $constraints)
{
//
}
# Available constraints
# classExists()
Ensure a specific class exists.
NB: This constraint will try to find the class with autoloading.
# executableIsInstalled()
Ensure a specific binary is present on your system.
Paths
When Lantern searches for an executable, it must search certain paths on the server.
These paths can be configured in your AppServiceProvider.
# extensionIsLoaded()
Ensure a particular PHP extension is loaded.
What extensions do you have?
To check the extensions loaded in your environment:
php -m
# Constraint caching
When a Constraint
is checked, the result of that check is cached. This is to avoid needlessly running the same check
over and over again.
The whole point of a Constraint
check is to ensure the Action
is available within the current environment, and that
environment is not expected to change within the same request.