src/Tools/Utilities.php
function saveFile($pFileName, $pContent)
    {
        $directory = \dirname($pFileName);

        if (!\is_dir($directory)) {
            try {
                $madeDir = \mkdir($directory, 0755, TRUE);

            } catch (\Exception $err) {
                throw new \Exception("mkdir: Unable make directory '{$directory}'.");
            }
        }

        // Save data to a file.
        $fileSaved = \file_put_contents($pFileName, $pContent); //, \LOCK_EX );

        if ($fileSaved === FALSE) {
            throw new \Exception("file_put_contents: Unable to save file '{$pFileName}'.");
        }

        return $fileSaved;
    }
function saveFile($pFileName, $pContent)
    {
        $directory = \dirname($pFileName);

        if (!\is_dir($directory)) {
            try {
                $madeDir = \mkdir($directory, 0755, TRUE);

            } catch (\Exception $err) {
                throw new \Exception("mkdir: Unable make directory '{$directory}'.");
            }
        }

        // Save data to a file.
        $fileSaved = \file_put_contents($pFileName, $pContent); //, \LOCK_EX );

        if ($fileSaved === FALSE) {
            throw new \Exception("file_put_contents: Unable to save file '{$pFileName}'.");
        }

        return $fileSaved;
    }
function saveFile ( $ pFileName , $ pContent ) { $ directory = \ dirname ( $ pFileName ) ; if ( ! \ is_dir ( $ directory ) ) { try { $ madeDir = \ mkdir ( $ directory , 0755 , TRUE ) ; } catch ( \ Exception $ err ) { throw new \ Exception ( "mkdir: Unable make directory '{$directory}'." ) ; } } // Save data to a file. $ fileSaved = \ file_put_contents ( $ pFileName , $ pContent ) ; //, \LOCK_EX ); if ( $ fileSaved === FALSE ) { throw new \ Exception ( "file_put_contents: Unable to save file '{$pFileName}'." ) ; } return $ fileSaved ; }
Save content to a file; but will also make the directory if it does not exists.

@param string $pFileName path.
@param string $pContent data to save in the file.
@throws \Exception
@return bool
Save content to a file ; but will also make the directory if it does not exists .