composer require mediarox/module-current-product-and-category
or added it to your
projects composer.json as a dependency.
Depending on the case inject class \Mediarox\CurrentProductAndCategory\Model\Registry\CurrentProduct
to retrieve current product and class \Mediarox\CurrentProductAndCategory\Model\Registry\CurrentCategory
to retrieve the current category.