PHPackages                             task/filesystem - 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. task/filesystem

ActiveLibrary

task/filesystem
===============

Filesystem plugin for Task

v0.2.1(12y ago)12.8k2MITPHP

Since Apr 23Pushed 11y ago2 watchersCompare

[ Source](https://github.com/taskphp/filesystem)[ Packagist](https://packagist.org/packages/task/filesystem)[ RSS](/packages/task-filesystem/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (9)Versions (4)Used By (2)

task/filesystem
===============

[](#taskfilesystem)

[![Build Status](https://camo.githubusercontent.com/08bde4b5e94e81fa693f4f2e77127ecd84b12cacf7fd9509d2b631a5493a6088/68747470733a2f2f7472617669732d63692e6f72672f7461736b7068702f66696c6573797374656d2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/taskphp/filesystem)[![Coverage Status](https://camo.githubusercontent.com/89f30a0396c6295fba745e7cba162d8213ee8c0fccba0e482f7894ceaea1d69f/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f7461736b7068702f66696c6573797374656d2f62616467652e706e673f6272616e63683d6d6173746572)](https://coveralls.io/r/taskphp/filesystem?branch=master)

Example
=======

[](#example)

```
use Task\Plugin\FilesystemPlugin;
use Symfony\Component\Finder\Finder;

$project->inject(function ($container) {
    $container['fs'] = new FilesystemPlugin;
});

$project->addTask('write', ['fs', function ($fs) {
    $fs->open('/tmp/foo')->write('wow');
}]);

$project->addTask('read', ['fs', function ($fs) {
    $fs->read('/tmp/foo')->pipe($this->getOutput());
}]);

$project->addTask('copy', ['fs', function ($fs) {
    $fs->copy('/tmp/foo', '/tmp/bar');
    # OR
    $fs->read('/tmp/foo')->pipe($fs->touch('/tmp/bar'));
}]);

$project->addTask('copyTree', ['fs', function ($fs) {
    $finder = new Finder;
    $finder->name('foo')->in('/tmp/source');
    $fs->copyTree('/tmp'source', '/tmp/target', $finder);
}]);
```

Installation
============

[](#installation)

Add to `composer.json`:

```
...
"require-dev": {
    "task/filesystem": "~0.2"
}
...
```

Usage
=====

[](#usage)

`Task\Plugin\FilesystemPlugin` extends Symfony's `Filesystem` component object, overring some methods and providing some new ones. Many of these methods return streams which can be piped to other plugins. `open`
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#taskpluginfilesystemplugin-extends-symfonys-filesystem-component-object-overring-some-methods-and-providing-some-new-ones-many-of-these-methods-return-streams-which-can-be-piped-to-other-pluginsopen)

`open($filename, $mode = 'r+')`

Returns `Task\Plugin\Filesystem\File`, opened with the specified mode. `touch`
------------------------------------------------------------------------------

[](#returns-taskpluginfilesystemfile-opened-with-the-specified-modetouch)

`FilesystemPlugin::touch($filename, $time = null, $atime = null)`

See Symfony's `Filesystem::touch` documentation for argument description. Returns `Task\Plugin\Filesystem\File`, opened with `r+`. `ls`
---------------------------------------------------------------------------------------------------------------------------------------

[](#see-symfonys-filesystemtouch-documentation-for-argument-description-returns-taskpluginfilesystemfile-opened-with-rls)

`ls($dir)`

Returns `Task\Plugin\Filesystem\FilesystemIterator`. `copy`
-----------------------------------------------------------

[](#returns-taskpluginfilesystemfilesystemiteratorcopy)

`copy($source, $target, $override = false)`

Supports multiple operations, e.g.

Given:

```
use Task\Plugin\FilesystemPlugin;
$fs = new FilesystemPlugin;
```

File to file:

```
/
    foo

```

```
# @return File('bar')
$fs->copy('foo', 'bar')
```

```
/
    foo
    bar

```

File to directory:

```
/
    foo
    bar/

```

```
# @return File('bar/foo')
$fs->copy('foo', 'bar')
```

```
/
    foo
    bar/
        foo

```

Link to link:

```
/
    foo
    bar -> foo

```

```
# @return File('wow')
$fs->copy('foo', 'wow')
```

```
/
    foo
    bar -> foo
    wow -> foo

```

Directory to directory:

```
/
    foo/
        bar

```

```
# @return FilesystemIterator('wow')
$fs->copy('foo', 'wow')
```

```
/
    foo/
        bar
    wow/
        bar

```

`mirror`
--------

[](#mirror)

`mirror($originDir, $targetDir, Traversable $iterator = null, $options = [])`Mirror a directory, optionally providing a `Traversable` instance to select or exclude files. Symfony's `Finder` component is really good for this:

```
/
    foo/
        .git/
            objects/
        bar
        baz

```

```
use Task\Plugin\FilesystemPlugin;
use Symfony\Component\Finder\Finder;

$finder = new Finder;
$finder->ignoreVcs()->in('foo');

$fs = new FilesystemPlugin;
# @return FilesystemIterator('wow')
$fs->mirror('foo', 'wow', $finder);
```

```
/
    foo/
        .git/
            objects/
        bar
        baz
    wow/
        bar
        baz

```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.5% 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 ~4 days

Total

3

Last Release

4400d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a2690beef16c00adcf9d21b025550c9b6fda653cfd57b5f99db279c459fb77ae?d=identicon)[mbfisher](/maintainers/mbfisher)

---

Top Contributors

[![mbfisher](https://avatars.githubusercontent.com/u/1162326?v=4)](https://github.com/mbfisher "mbfisher (14 commits)")[![ls12styler](https://avatars.githubusercontent.com/u/409462?v=4)](https://github.com/ls12styler "ls12styler (2 commits)")

### Embed Badge

![Health badge](/badges/task-filesystem/health.svg)

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

###  Alternatives

[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k235.4M9.7k](/packages/symfony-framework-bundle)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M82](/packages/symplify-monorepo-builder)[temporal/sdk

Temporal SDK

4002.2M18](/packages/temporal-sdk)[acquia/orca

A tool for testing a company's software packages together in the context of a realistic, functioning, best practices Drupal build

32902.4k](/packages/acquia-orca)[drevops/git-artifact

Package artifact from your codebase in CI and push it to a separate git repo.

2133.2k](/packages/drevops-git-artifact)

PHPackages © 2026

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