PHP code example of sndsgd / fs

1. Go to this page and download the library: Download sndsgd/fs library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sndsgd / fs example snippets


use \sndsgd\Fs;

# lets assume `/tmp/some` doesn't exist
$path = "/tmp/some/deep/path/file.txt";

# write to a file that doesn't exist in a directory that doesn't exist
$file = Fs::getFile($path);
if ($file->write("the contents...") === false) {
   throw new Exception($file->getError());
}