PHPackages                             vasek-purchart/phing-copy-files-task - 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. vasek-purchart/phing-copy-files-task

ActiveLibrary[File &amp; Storage](/categories/file-storage)

vasek-purchart/phing-copy-files-task
====================================

Copy files with better control over copying than the default Phing CopyTask

2.0(7y ago)255.0k↓30.8%1[4 PRs](https://github.com/VasekPurchart/Phing-Copy-Files-Task/pulls)MITPHPPHP ~7.2CI passing

Since Mar 27Pushed 1y ago1 watchersCompare

[ Source](https://github.com/VasekPurchart/Phing-Copy-Files-Task)[ Packagist](https://packagist.org/packages/vasek-purchart/phing-copy-files-task)[ RSS](/packages/vasek-purchart-phing-copy-files-task/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (6)Versions (6)Used By (0)

Phing Copy Files Task
=====================

[](#phing-copy-files-task)

Copy files with better control over copying than the default Phing [`CopyTask`](https://www.phing.info/docs/guide/trunk/CopyTask.html).

The main disadvantage of the default task is that it ignores the `overwrite="false"` setting (which is also default) and if the source file is newer, it always rewrites the target file (see [phingofficial/phing#538](https://github.com/phingofficial/phing/issues/538)). This is unexpected and potentially very dangerous behaviour especially when copying configuration files etc.

`CopyFilesTask` has much narrower use-cases, but offers you more control about the copied files. It works only with files (not directories or filesets) and you can specify how exactly each of the files should be copied and what to do when the target already exists.

Usage
-----

[](#usage)

To copy a file you can just write:

```

```

The paths are relative to the location of the buildfile. If you want to use absolute paths, you can write paths using `${project.basedir}`, which contains the location of the buildfile.

You can also copy multiple files within one task definition:

```

```

### Target file exists mode

[](#target-file-exists-mode)

If the target file already exists, there are three modes how you can choose that the situation will be handled:

1. `skip` (default) - copying of the file is skipped (and logged to output)
2. `replace` - always replace target file, even if it exists
3. `fail` - do not overwrite the target file and fail the build

You can set the mode for all files at once with `existsmode` parameter on ``:

```

```

And also for each ``, meaning it will override the `` setting:

```

```

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

[](#installation)

1. Install package [`vasek-purchart/phing-copy-files-task`](https://packagist.org/packages/vasek-purchart/phing-copy-files-task) with [Composer](https://getcomposer.org/):

```
composer require vasek-purchart/phing-copy-files-task
```

2. Register this task under a name of your choosing.

There are several ways how to register a task, see the `TaskDefTask` documentation. The recommended way is putting this in your `build.xml`:

```

```

You can pick any other name for the command if you would like to.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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 ~643 days

Total

2

Last Release

2696d ago

Major Versions

1.0 → 2.02018-12-31

PHP version history (2 changes)1.0PHP ~7.0

2.0PHP ~7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/48831f7e09a459d6f2761d53922e26cef1579c030524f5c36f54964f0d6541e1?d=identicon)[VasekPurchart](/maintainers/VasekPurchart)

---

Top Contributors

[![VasekPurchart](https://avatars.githubusercontent.com/u/406821?v=4)](https://github.com/VasekPurchart "VasekPurchart (59 commits)")

---

Tags

copyfilesphingphing-taskscopyfiletaskphing

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vasek-purchart-phing-copy-files-task/health.svg)

```
[![Health](https://phpackages.com/badges/vasek-purchart-phing-copy-files-task/health.svg)](https://phpackages.com/packages/vasek-purchart-phing-copy-files-task)
```

###  Alternatives

[league/flysystem

File storage abstraction for PHP

13.6k639.1M2.2k](/packages/league-flysystem)[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.6k263.6M790](/packages/league-flysystem-aws-s3-v3)[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[knplabs/knp-gaufrette-bundle

Allows to easily use the Gaufrette library in a Symfony project

72428.6M91](/packages/knplabs-knp-gaufrette-bundle)[league/flysystem-local

Local filesystem adapter for Flysystem.

225231.8M39](/packages/league-flysystem-local)[league/flysystem-memory

In-memory filesystem adapter for Flysystem.

8533.6M194](/packages/league-flysystem-memory)

PHPackages © 2026

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