How can I use aliases in a module / plugin? I'm writing a module that needs to grab the path of a file.

I know I can use {{ alias('@webroot') }} in the templates to get the root web folder. Is there a way I can do this in module/plugin land?

I've been looking for PHP constants or similar, and landed on $fullpath = CRAFT_BASE_PATH . '/web/' . $filename; which doesn't feel great.

Cheers!
Would it be an option for you to use 

Craft::getAlias('@webroot');


Yii2 Aliases