PHPackages                             weew/helpers-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. weew/helpers-filesystem

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

weew/helpers-filesystem
=======================

Collection of useful filesystem helpers.

v1.2.1(9y ago)110.7k↓91.7%4MITPHP

Since Jul 21Pushed 9y ago2 watchersCompare

[ Source](https://github.com/weew/helpers-filesystem)[ Packagist](https://packagist.org/packages/weew/helpers-filesystem)[ RSS](/packages/weew-helpers-filesystem/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (12)Used By (4)

Filesystem helpers
==================

[](#filesystem-helpers)

[![Build Status](https://camo.githubusercontent.com/a51bc9941ebda3e76190ea4cebdaf6ff27fee4394f35e040a1110233d126106f/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f776565772f68656c706572732d66696c6573797374656d2e737667)](https://travis-ci.org/weew/helpers-filesystem)[![Test Coverage](https://camo.githubusercontent.com/d3f8c4ebe45f020428eb7f3764283f4ca3923d61d065965ccac96b4c297d0828/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f776565772f68656c706572732d66696c6573797374656d2e737667)](https://coveralls.io/github/weew/helpers-filesystem)[![Version](https://camo.githubusercontent.com/76445e55413c2c48f3126f7c9d8a13f5db94d7fe2756a25447efa103f80d84cc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f776565772f68656c706572732d66696c6573797374656d2e737667)](https://packagist.org/packages/weew/helpers-filesystem)[![Licence](https://camo.githubusercontent.com/64bad462bb8cbe0e41d8846d350677a4c269dc80a8cb5809d776ea934469ecad/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f776565772f68656c706572732d66696c6573797374656d2e737667)](https://packagist.org/packages/weew/helpers-filesystem)

Table of contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Introduction](#introduction)
- [Functions](#functions)
    - [file\_get\_directory](#file_get_directory)
    - [file\_get\_extension](#file_get_extension)
    - [file\_get\_name](#file_get_name)
    - [file\_read](#file_read)
    - [file\_create](#file_create)
    - [file\_write](#file_write)
    - [file\_append](#file_append)
    - [file\_prepend](#file_prepend)
    - [file\_delete](#file_delete)
    - [file\_move](#file_move)
    - [file\_copy](#file_copy)
    - [file\_rename](#file_rename)
    - [directory\_get\_name](#directory_get_name)
    - [directory\_get\_parent](#directory_get_parent)
    - [directory\_create](#directory_create)
    - [directory\_delete](#directory_delete)
    - [directory\_exists](#directory_exists)
    - [directory\_rename](#directory_rename)
    - [directory\_move](#directory_move)
    - [directory\_copy](#directory_copy)
    - [directory\_clear](#directory_clear)
    - [directory\_list](#directory_list)
    - [directory\_list\_files](#directory_list_files)
    - [directory\_list\_directories](#directory_list_directories)

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

[](#installation)

`composer require weew/helpers-filesystem`

Introduction
------------

[](#introduction)

This tiny library provides various helper functions to deal with files and directories in a concise and easy way.

Functions
---------

[](#functions)

#### file\_get\_directory

[](#file_get_directory)

Get name of the file's directory.

`string file_get_directory(string $path)`

#### file\_get\_extension

[](#file_get_extension)

Get name of the file's directory.

`string file_get_extension(string $path)`

#### file\_get\_name

[](#file_get_name)

Get name of the file's directory.

`string file_get_name(string $path)`

#### file\_read

[](#file_read)

Read contents of a file.

`mixed file_read(string $path)`

#### file\_create

[](#file_create)

Create a file and all necessary subdirectories.

`bool file_create(string $path)`

#### file\_write

[](#file_write)

Write to a file.

`bool file_write(string $path, string $content)`

#### file\_append

[](#file_append)

Append contents to the end of file.

`bool file_append(string $path, string $content)`

#### file\_prepend

[](#file_prepend)

Prepend contents to the beginning of file.

`bool file_prepend(string $path, string content)`

#### file\_delete

[](#file_delete)

Delete a file.

`bool file_delete(string $path)`

#### file\_rename

[](#file_rename)

Move a file from one location to another and create all necessary subdirectories.

`bool file_rename(string $oldPath, string $newPath)`

#### file\_copy

[](#file_copy)

Copy a file from one location to another and create all necessary subdirectories.

`bool file_copy(string $oldPath, string $newPath)`

#### file\_rename

[](#file_rename-1)

Rename file at the given path.

`bool file_rename(string $path, $newName)`

#### directory\_get\_name

[](#directory_get_name)

Get name of the file's directory.

`string directory_get_name(string $path)`

#### directory\_get\_parent

[](#directory_get_parent)

Get path of the parent directory.

`string directory_get_parent(string $path)`

#### directory\_create

[](#directory_create)

Create a directory and all subdirectories.

`bool directory_create(string $path [, $mode = 0777])`

#### directory\_delete

[](#directory_delete)

Delete a directory and all of its files.

`bool directory_delete(string $path)`

#### directory\_exists

[](#directory_exists)

Check if a directory exists.

`bool directory_exists(string $path)`

#### directory\_rename

[](#directory_rename)

Rename a directory.

`bool directory_rename(string $path, string $newName)`

#### directory\_move

[](#directory_move)

Move directory to the specified path.

`bool directory_move(string $oldPath, string $newPath)`

#### directory\_copy

[](#directory_copy)

Copy a directory and all of its contents to the specified path and create all necessary subdirectories.

`bool directory_copy(string $oldPath, string $newPath)`

#### directory\_clear

[](#directory_clear)

Delete all files and directories inside a directory.

`directory_clear(string $path)`

#### directory\_list

[](#directory_list)

Return a list of files and directories. `$absolute` indicates whether the paths should be relative or absolute.

`string[] directory_list(string $path [, $absolute = false])`

#### directory\_list\_files

[](#directory_list_files)

Return a list of files. `$absolute` indicates whether the paths should be relative or absolute.

`string[] directory_list_files(string $path [, $absolute = false])`

#### directory\_list\_directories

[](#directory_list_directories)

Return a list of directories. `$absolute` indicates whether the paths should be relative or absolute.

`string[] directory_list_directories(string $path [, $absolute = false])`

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity70

Established project with proven stability

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

Recently: every ~30 days

Total

11

Last Release

3633d ago

Major Versions

v0.0.5 → v1.0.02015-11-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/10b2b854b5829dd13a15967c000ed2119b5faef67aca24d94c653c8ac550d85e?d=identicon)[weew](/maintainers/weew)

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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