I'm creating a module in order to fix a bug in Magento 2.3.0 that will be part of the next release. So, I would like to restrict via Composer the dependencies of that module.
How can I restrict my module to run just with the Magento 2.3.0?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityI'm creating a module in order to fix a bug in Magento 2.3.0 that will be part of the next release. So, I would like to restrict via Composer the dependencies of that module.
How can I restrict my module to run just with the Magento 2.3.0?
You can check the Magento 2 version and run it when it's the version that you want, if not you can add a log warning to show a message like this example:
if($this->helper->getVersion() !== self::MAGENTO_COMPATIBLE_VERSION){
$this->logger->emergency('You are using a updated Magento version ' . Data::AMASTY_MODULE_NAME .'. Please check the module MyCompany_HotFix compatibility!' );
}
Reference: