Pass parameters to asset publish file

I wanna pass parameters to the file that I’m gonna publish through asset, is there anyway I can archive it?

Example: test.php


<?php

echo $var;

And then pass the variable


$var = "Hello World";

through


Yii::$app->assetManager->publish('test.php')

Is this porsible to do it?

I don’t think it’s possible. Asset Manager is designed specifically for static assets. Dynamic assets should be served via controller actions.

Thank you very much, it works.

@phtamas I’m making a widget, how can i pass parameters to the asset using a controller?