PHPackages                             ulrack/vfs - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. ulrack/vfs

Abandoned → [grizz-it/vfs](/?search=grizz-it%2Fvfs)ArchivedLibrary[File &amp; Storage](/categories/file-storage)

ulrack/vfs
==========

Virtual File System from Ulrack.

2.0.1(6y ago)01031MITPHPPHP ^7.2

Since Feb 22Pushed 6y ago1 watchersCompare

[ Source](https://github.com/ulrack/vfs)[ Packagist](https://packagist.org/packages/ulrack/vfs)[ RSS](/packages/ulrack-vfs/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (1)

DEPRECATION NOTICE: this package has been moved and improved at [grizz-it/vfs](https://github.com/grizz-it/vfs)
===============================================================================================================

[](#deprecation-notice-this-package-has-been-moved-and-improved-at-grizz-itvfs)

[![Build Status](https://camo.githubusercontent.com/3d15e80147a0db12c5e9919b62292dd5e53fc38ff559c9d28829f810d1918d9a/68747470733a2f2f7472617669732d63692e636f6d2f756c7261636b2f7666732e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/ulrack/vfs)

Ulrack VFS
==========

[](#ulrack-vfs)

Ulrack VFS is a Virtual File System implementation in PHP. It allows the creation of confined file and directory operation classes.

Installation
------------

[](#installation)

To install the package run the following command:

```
composer require ulrack/vfs

```

Usage
-----

[](#usage)

### Drivers

[](#drivers)

Drivers are build to connect to a file system. This package only contains a driver for a local file system. The drivers are build upon `Ulrack\Vfs\Common\FileSystemDriverInterface`.

#### Ulrack\\Vfs\\Component\\Driver\\LocalFileSystemDriver

[](#ulrackvfscomponentdriverlocalfilesystemdriver)

This implementation serves as a factory for the `Ulrack\Vfs\Component\FileSystem\LocalFileSystem`. An example implementation looks like the following:

```
use Ulrack\Vfs\Driver\LocalFileSystemDriver;

$driver = new LocalFileSystemDriver();

$fileSystem = $driver->connect(__DIR__ . '/tests/test-filesystem');
```

This would yield a file system confined to the directory `ulrack/vfs/test/test-filesystem`.

### File Systems

[](#file-systems)

File systems are based on `Ulrack\Vfs\Common\FileSystemInterface`. File systems provide basic functionalities of PHP for file and directory manipulation, but based on an interface. This simplifies changing the sources of your files and directories.

#### Ulrack\\Vfs\\Component\\FileSystem\\LocalFileSystem

[](#ulrackvfscomponentfilesystemlocalfilesystem)

This class implements the functionalities to manipulate a confined local file system. The creation of this class is recommended to be done through the `LocalFileSystemDriver`, but can also be performed without it:

```
use Ulrack\Vfs\FileSystem\LocalFileSystem;

$filesystem = new LocalFileSystem(__DIR__ . '/tests/test-filesystem');
```

### Files

[](#files)

This package also provides an iterator class for files. This iterator is build on the `Ulrack\Vfs\Common\FileInterface`.

#### Ulrack\\Vfs\\Component\\File\\File

[](#ulrackvfscomponentfilefile)

This class is the implementation of the `FileInterface`. It exposes iterator and `ArrayAccess` functionalities on a file.

Files can be opened in 2 different modes.

**MODE\_CHUNK**

This mode iterates over the file in predetermined sized chunks. The write operations completely override a chunk (even if the size is different). The chunk size in this mode determines the amount of bytes to read.

**MODE\_LINE**

This mode iterates over the file per line (using `PHP_EOL`). The write operations completely override the line at the defined position. The chunk size in this mode determines the maximum amount of bytes a line can be.

The `File` class can be created from a `LocalFileSystem` by calling `getFileIterable`. To create one, open a file in `r+` mode and pass the resource together with the desired mode and a chunk size to the constructor:

```
use Ulrack\Vfs\Common\FileInterface;
use Ulrack\Vfs\File\File;

$fileResource = fopen(__DIR__ . '/tests/test-filesystem/foo.txt');
$fileIterable = new File($fileResource, FileInterface::MODE_LINE);
```

The iterable can then be used, just like an array:

```
// Write foo to the second line.
$fileIterable[1] = 'foo';

// Outputs foo
echo $fileIterable[1];

// Removes foo from the file.
unset($fileIterable[1]);

// Appends foo as a line to the end of the file.
$fileIterable[] = 'foo';

// Will output the line and line number for every line in the file.
foreach ($fileIterable as $key => $line) {
    echo sprintf('Line %d says: %s', $key + 1, $line);
}
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

MIT License
-----------

[](#mit-license)

Copyright (c) 2019 GrizzIT

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~125 days

Total

4

Last Release

2307d ago

Major Versions

1.0.1 → 2.0.02019-11-10

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8682881?v=4)[GrizzIT](/maintainers/GrizzIT)[@grizzit](https://github.com/grizzit)

---

Top Contributors

[![mfrankruijter](https://avatars.githubusercontent.com/u/8653925?v=4)](https://github.com/mfrankruijter "mfrankruijter (8 commits)")

---

Tags

filesystemphpulrackvfsvfs

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/ulrack-vfs/health.svg)

```
[![Health](https://phpackages.com/badges/ulrack-vfs/health.svg)](https://phpackages.com/packages/ulrack-vfs)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
