PHPackages                             sauvank/php-file-tools - 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. sauvank/php-file-tools

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

sauvank/php-file-tools
======================

Simple tools for files

3.1.2(5y ago)041[1 PRs](https://github.com/sauvank/packagist-php-file-tools/pulls)MITPHPCI failing

Since Aug 2Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/sauvank/packagist-php-file-tools)[ Packagist](https://packagist.org/packages/sauvank/php-file-tools)[ RSS](/packages/sauvank-php-file-tools/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (10)Dependencies (1)Versions (13)Used By (0)

Packagist Move files
====================

[](#packagist-move-files)

#### A simple package for get files with extension and move.

[](#a-simple-package-for-get-files-with-extension-and-move)

#### Required

[](#required)

- PHP &gt;=7.4

#### Run with docker (branch : docker)

[](#run-with-docker-branch--docker)

> ./helper install

#### Run unit test

[](#run-unit-test)

- In folder app :

    > vendor/bin/phpunit tests

    OR

    > ./run\_test.sh

- Install with composer :

    > composer require sauvank/file-tools

#### List function

[](#list-function)

```
MoveFile::move(string $src, string $output, bool $createOutputPath [default : true], $windowsNameValid [default : true]): File

* string $src, source of the file to move
* string $output, output of the file
* bool $createOutputPath, default true, if the folder does not exist, create them.

Return instance of File in case of success or Exeption if error
.

```

- $files, multidimensional array.
    - each array need :
        - string 'src', source of the file to move
        - string 'output', output of the file
    - optional :
        - bool 'createOutputPath' default true, if the folder does not exist, create them.
        - bool 'windowsNameValid' default true, modify the output path to be valid for windows.

---

```
MoveFile::moveMultiple(array $files)

```

- $files, multidimentionnal array
    - each array need :
        - string 'src', source of the file to move
        - output 'src', output of the file
    - optional :
        - bool 'createOutputPath' default true, if the folder does not exist, create them.

Return array instance File in case of success or Exeption if error

---

```
GetFile::byExtension(string $folderPath, array $extsToGet = [], array $excludeFolder = ['\$RECYCLE\.BIN', 'Trash-1000', 'found\.000'])

```

- string $folderPath, path of the folder to get files
- array $extsToGet, array contain extention files to get. ex: \['mkv', 'mp4'\]
- array $excludeFolder, array contain folder name to exclude.

Return array instance File or Exeption if error

---

```
GetFile::byFolderAndExtension(string $folderPath, array $extsToGet = [], array $excludeFolder = ['\$RECYCLE\.BIN', 'Trash-1000', 'found\.000'])

```

- string $folderPath, path of the folder to get files
- array $extsToGet, array contain extention files to get. ex: \['mkv', 'mp4'\]
- array $excludeFolder, array contain folder name to exclude.

Return array ultidimentional array with key equal folder and value equal file or Exeption if error

exemple return : \[

```
["folder_path/folder 1"]=> [
    0 => object(FileTools\File),
    1 => object(FileTools\File),
    2 => object(FileTools\File),
],
["folder_path/folder 2"]=> [
        0 => object(FileTools\File),
        1 => object(FileTools\File),
        2 => object(FileTools\File),
],

```

\]

---

### Exemple :

[](#exemple-)

#### move one files

[](#move-one-files)

```
use FileTools\MoveFile;
$moveFile = new MoveFile();

try{
    $result = $mv->move('tests/test_unit.mp4', 'tests/test_unit.mp4');
    // instance of File
}catch (Exception $e){
    var_dump('Catch: ' . $e->getMessage());
}

```

#### move multiple files

[](#move-multiple-files)

> exemple :

```
use FileTools\MoveFile;
$moveFile = new MoveFile();
$data = [
    [
        'src' => 'tests/samples/fake_mkv.mkv',
        'output' => 'tests/samples/',
        'createOutputPath' => false
    ],
    [
        'src' => 'tests/samples/ii.mkv',
        'output' => 'tests/samples/',
        'createOutputPath' => false
    ],
    [
        'src' => 'tests/samples/fake_mkv.mkv',
        'output' => 'tests/samples/ii/',
        'createOutputPath' => false
    ],
];

try{
    $result = $moveFile->moveMultiple($data);
    // array instance of File
}catch (Exception $e){
    var_dump('Catch: ' . $e->getMessage());
}

```

### Class File function

[](#class-file-function)

```
getDirname(): ?string

```

```
setDirname($dirname): void

```

```
getBasename(): ?string

```

```
setBasename($basename): void

```

```
getExtension(): ?string

```

```
setExtension($extension): void

```

```
getFilename(): ?string

```

```
setFilename($filename): void

```

```
getFullPath(): ?string

```

```
getMimeType(): ?string

```

```
getFileSize():?int

```

```
getLastPath(): ?string

```

```
setLastPath($lastPath): void

```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance53

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

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

Total

11

Last Release

2035d ago

Major Versions

1.2.2 → 3.0.02020-10-11

### Community

Maintainers

![](https://www.gravatar.com/avatar/66212db68ff816b452dc3e6d892413dded5c788fc3655b54c2dd9a5c75040cab?d=identicon)[sauvank](/maintainers/sauvank)

---

Top Contributors

[![sauvank](https://avatars.githubusercontent.com/u/17042316?v=4)](https://github.com/sauvank "sauvank (28 commits)")

### Embed Badge

![Health badge](/badges/sauvank-php-file-tools/health.svg)

```
[![Health](https://phpackages.com/badges/sauvank-php-file-tools/health.svg)](https://phpackages.com/packages/sauvank-php-file-tools)
```

###  Alternatives

[google/cloud-storage

Cloud Storage Client for PHP

34390.8M125](/packages/google-cloud-storage)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

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