Search by

phore / filesystem

dermatthes

Acces files layer

Package info

github.com/phore/phore-filesystem

Homepage

pkg:composer/phore/filesystem

Statistics

Installs: 13 371

Dependents: 33

Suggesters: 1

Stars: 1

Open Issues: 0

v1.1.0 2024-02-09 00:37 UTC

This package is auto-updated.

Last update: 2026-09-11 12:54:05 UTC


README

Actions Status

File access functions

  • Working with sub-paths
  • Checking symbolic links

Installation

compser require phore/filesystem

General usage

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

will result in

/tmp

Subpath

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

Assertions

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

Reading YAML

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

Front matter files

Jekyll-style YAML front matter can be read together with the remaining content:

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

Pass a class name to hydrate the header when phore/hydrator is installed:

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

Create or replace a front matter file with put_front_matter():

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

Tempoary Files

Will be unlinked when object destructs.

$file = new PhoreTempFile();