Magento template support script tag with X-MAGENTO-INIT declaration. You can pass dynamic PHP values to Javascript from a template file.
create demo.phtml file in your module to pass dynamic PHP value to Javascript, Continue reading “How to passing Dynamic arguments from template to RequireJs in magento 2?”