PHPackages                             phpfiletool/filetool - 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. phpfiletool/filetool

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

phpfiletool/filetool
====================

A PHP library for file and directory management.

v2.0.0(2mo ago)24GPL-3.0-or-laterPHPPHP ^8.4CI passing

Since Mar 2Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/AntonioCarioca/PHP-FileTool)[ Packagist](https://packagist.org/packages/phpfiletool/filetool)[ Docs](https://github.com/AntonioCarioca/PHP-FileTool)[ RSS](/packages/phpfiletool-filetool/feed)WikiDiscussions master Synced today

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

PHP FileTool
============

[](#php-filetool)

[![PHP Version](https://camo.githubusercontent.com/ce5e24773098115a50622c27c941e289b32b14a58fca172ffd80fcaaba1f0066/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e342532422d3737374242343f7374796c653d666f722d7468652d6261646765266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/ce5e24773098115a50622c27c941e289b32b14a58fca172ffd80fcaaba1f0066/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e342532422d3737374242343f7374796c653d666f722d7468652d6261646765266c6f676f3d706870266c6f676f436f6c6f723d7768697465)[![Packagist Version](https://camo.githubusercontent.com/e684ce1c392e8a58b48db74bdf438242a3d0aa71feff3a4ebfa7c55c8422aaf8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70687066696c65746f6f6c2f66696c65746f6f6c3f7374796c653d666f722d7468652d6261646765266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465266c6162656c3d5061636b6167697374)](https://camo.githubusercontent.com/e684ce1c392e8a58b48db74bdf438242a3d0aa71feff3a4ebfa7c55c8422aaf8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70687066696c65746f6f6c2f66696c65746f6f6c3f7374796c653d666f722d7468652d6261646765266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465266c6162656c3d5061636b6167697374)[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/19f5518a63aaa0045408d041a2c2db5472a66fac85764dd89c4dc411b87e79c3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f416e746f6e696f436172696f63612f5048502d46696c65546f6f6c2f63692e796d6c3f7374796c653d666f722d7468652d6261646765266c6162656c3d4349)](https://camo.githubusercontent.com/19f5518a63aaa0045408d041a2c2db5472a66fac85764dd89c4dc411b87e79c3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f416e746f6e696f436172696f63612f5048502d46696c65546f6f6c2f63692e796d6c3f7374796c653d666f722d7468652d6261646765266c6162656c3d4349)[![GitHub Release](https://camo.githubusercontent.com/66829420552b3083e8fb4ed984f48d12d78d9385e71f39bc0b0f7956c371abbc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f416e746f6e696f436172696f63612f5048502d46696c65546f6f6c3f7374796c653d666f722d7468652d6261646765266c6162656c3d52656c65617365)](https://camo.githubusercontent.com/66829420552b3083e8fb4ed984f48d12d78d9385e71f39bc0b0f7956c371abbc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f416e746f6e696f436172696f63612f5048502d46696c65546f6f6c3f7374796c653d666f722d7468652d6261646765266c6162656c3d52656c65617365)[![License](https://camo.githubusercontent.com/76791a2d6cd164de1170d85091c3786215ba891029e44e745201015c11911a07/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f416e746f6e696f436172696f63612f5048502d46696c65546f6f6c3f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/76791a2d6cd164de1170d85091c3786215ba891029e44e745201015c11911a07/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f416e746f6e696f436172696f63612f5048502d46696c65546f6f6c3f7374796c653d666f722d7468652d6261646765)

**PHP FileTool** is a simple PHP library for working with files and directories.

It provides useful methods to create, read, write, copy, rename, list and delete files or directories using a clean static API.

---

Features
--------

[](#features)

- Create files and directories
- Create multiple files at once
- Read and write file contents
- Copy files and file contents
- Copy all files from one directory to another
- Rename files and paths
- List directory files
- Delete files
- Delete empty directories
- Delete directories recursively
- Custom exceptions for safer error handling
- PSR-4 autoloading
- PHPUnit tests
- PHPStan static analysis
- PHPCS with PSR-12 standard
- GitHub Actions CI workflow

---

Requirements
------------

[](#requirements)

- PHP 8.4 or higher
- Composer

---

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

[](#installation)

Install the package with Composer:

```
composer require phpfiletool/filetool
```

---

Basic Usage
-----------

[](#basic-usage)

```
