Yaml config with file cache

Some people asked about loading configurations yaml. There is incubator class that use yaml extension. I wanted use yaml without yaml php extension and wrote this solutions with simple cache:

$di->setShared('fs', 'Symfony\Component\Filesystem\Filesystem');
$di->setShared('yaml_parser', 'Symfony\Component\Yaml\Parser');

$di->setShared('config', function () use ($di, $appPath) {
    $cachePath = $appPath . "/cache/config/config.php";

    if (false === file_exists($cachePath)) {
        $yamlPath = $appPath . "/config/config.yml";
        $yaml = file_get_contents($yamlPath);
        $config = $di['yaml_parser']->parse($yaml);

        $di['fs']->dumpFile($configPath, "<?php" . "\n" . "return " . var_export($config, true) . ";");
    } else {
        $config = include $path . '/cache/config/config.php';
    }

    return new \Phalcon\Config($config);
});

$cachePath should be $configPath Please correct and I remove my comment