How to access $webroot_dir variable in composer package (library not wp plugin)

hello, how can I access the variables like $webroot and other constants available in applications.php from a custom built package that lives in vendor and is autoloaded by composer ?

You don’t — they’re not global variables. I can’t imagine why you would ever need to access that. Maybe explain what you’re trying to accomplish?

i am building a project specific package that will move some composer packages around, set permissions on files and folders and do a few wp-cli clean up jobs. I wanted it to be a composer package (not a wp plugin) it is autoloaded and triggered after composer install. I wanted to acces the project variables / constants as it needs to be aware of the folder structure of the project, thanks

if I can’t access the variables in application.php then I will have to replicate some of the declarations in another config file available to my project, this would mean maintaining 2 lists of variable declarations in 2 places which seems wrong as the variables in my custom config file are in application.php any way