private static function saveToFile($path, $contents)
    {
        $directory = pathinfo($path, PATHINFO_DIRNAME);
        if (!file_exists($directory)) {
            mkdir($directory, 0777, true);
        }
        file_put_contents($path, $contents);
    }
private static function saveToFile($path, $contents)
    {
        $directory = pathinfo($path, PATHINFO_DIRNAME);
        if (!file_exists($directory)) {
            mkdir($directory, 0777, true);
        }
        file_put_contents($path, $contents);
    }
private static function saveToFile ( $ path , $ contents ) { $ directory = pathinfo ( $ path , PATHINFO_DIRNAME ) ; if ( ! file_exists ( $ directory ) ) { mkdir ( $ directory , 0777 , true ) ; } file_put_contents ( $ path , $ contents ) ; }
Extended version of file put contents that also creates the directory tree if it doesn't
exist.

@param string $path the absolute or relative path to which to save the data
@param string $contents the contents to be saved to the file
Extended version of file put contents that also creates the directory tree if it doesn t exist .