FileHelper Examples

Last updated: September 26th, 2021
Release:

FileHelper Examples

 

Basic Usage
use Stoic\Utilities\FileHelper;

$fh = new FileHelper('./');

// the '~' prefix on a path will be intelligently replaced with './'
if ($fh->folderExists('~/files') && $fh->fileExists('~/files/myFile.txt')) {
	$contents = $fh->getContents('~/files/myFile.txt');
	$fh->putContents('~/files/myFile.txt', strrev($contents));
}

Further Reading

Next Up

Continue to read about LogconsoleAppender, or visit the Table of Contents.