@asset
is a directive which will only work in Blade templates. See: Use function in app.php to build url for image html - understanding scope/templates
As for how you should load that dictionary it depends on what sort of thing it is. An “asset” is generally something that runs through the build process and is compiled, transpiled, compressed, etc. More specifically though, and asset is a file that needs a publicly accessible url. An image needs that; a file loaded by a PHP script does not. WordPress provides the get_stylesheet_directory()
function to return the path of files in your theme.