How to get the module version number from composer programmatically by Magento 2?

You can fetch/read the current module composer version number from the composer.json file programmatically in Magento 2.

Before fetching the current version, Your module must contain the composer.json file because we are reading the version number from the composer file only.

You can just create a simple Model class and create a function to return the module version. Continue reading “How to get the module version number from composer programmatically by Magento 2?”

Magento 2 Error on pages Class Magento\Framework\Filter\VariableResolver\StrategyResolver does not exist.

I am facing an error while looking at any pages on the front end by getting the latest code from the branch.
I have just checked out with the branch that has upgraded Magento to the latest version 2.4.6-p1.

Every page in the front end throws an error like the given, Continue reading “Magento 2 Error on pages Class Magento\Framework\Filter\VariableResolver\StrategyResolver does not exist.”

How to create custom log file in Magento 2 module?

You can create your custom log file as a module in the var/log folder. You can generate a .log file based on your module name or functionality-related name.

You need to create an etc/di.xml file and specify the virtual type for the logger.

Create a Virtual type for the class Magento\Framework\Logger\Handler\Base to specify your custom file name. Continue reading “How to create custom log file in Magento 2 module?”