Pass data from yaml to php

hi everyone, I have a yaml file which returns an API. like this in example:

MYAPI: “https://prova1api.herokuapp.com/RedHotCHiliPeppersDiscography

I would like to take MYAPI and pass it in a php file, like this in example:

api_data = json_decode ( MYAPI, true);
this-> grav ['twig'] -> twig_vars ['api_data'] = api_data;