An open API service indexing awesome lists of open source software.

https://github.com/phore/phore-filesystem

File access functions
https://github.com/phore/phore-filesystem

phore-filesystem

Last synced: 5 months ago
JSON representation

File access functions

Awesome Lists containing this project

README

          

# phore-filesystem

[![Actions Status](https://github.com/phore/phore-filesystem/workflows/tests/badge.svg)](https://github.com/phore/phore-filesystem/actions)

File access functions

- Working with sub-paths
- Checking symbolic links

## Installation

```
compser require phore/filesystem
```

## General usage

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

will result in

```
/tmp
```

## Subpath

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

```
/tmp/some/other/file
```

## Assertions

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

## Reading YAML

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

## Tempoary Files

Will be unlinked when object destructs.

```
$file = new PhoreTempFile();
```