PHP code example of phore / filesystem

1. Go to this page and download the library: Download phore/filesystem 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/ */

    

phore / filesystem example snippets


$root = phore_dir('/srv/site/docs', [
    'rootDir' => '/srv/site/docs',
]);

$page = $root->withSubPath('index.md')->asFile();
echo $page->get_contents();

echo phore_uri("/tmp/some.file")->withDirName();

echo phore_uri("/tmp")->withSubPath("./some/other/file")

phore_uri("/tmp")->assertIsFile()->assertIsWritable();

phore_uri("/tmp/somefile.yml")->assertFile()->get_yaml();

$document = phore_file("post.md")->get_front_matter();
echo $document->header["title"];
echo $document->content;

$document = phore_file("post.md")->get_front_matter(PostHeader::class);
echo $document->header->title;

phore_file("post.md")->put_front_matter(
    new \Phore\FileSystem\FrontMatterFile(null, ["title" => "Example"], "Content")
);

$file = new PhoreTempFile();