PHPackages                             atk14/files - 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. atk14/files

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

atk14/files
===========

A PHP class for basic file manipulation

v1.6.6(1y ago)049.2k↑61.1%116MITPHPPHP &gt;=5.3.0

Since Jan 23Pushed 1y ago2 watchersCompare

[ Source](https://github.com/atk14/Files)[ Packagist](https://packagist.org/packages/atk14/files)[ Docs](https://github.com/atk14/Files)[ RSS](/packages/atk14-files/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (18)Used By (16)

Files
=====

[](#files)

[![Build Status](https://camo.githubusercontent.com/6acec254b764709486d1ef197c9e0b9e20ff902f0e5c3512df66016dfdd91382/68747470733a2f2f7472617669732d63692e6f72672f61746b31342f46696c65732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/atk14/Files)

A PHP class for basic file manipulation.

Basic usage
-----------

[](#basic-usage)

Files is just a bunch of static functions.

```
$content = Files::GetFileContent("/path/to/a/file");

```

To recursively delete a directory

```
$items_deleted = Files::RecursiveUnlinkDir("/path/to/a/dir");

```

To determine a file type

```
$mime_type = Files::DetermineFileType("/path/to/a/file"); // "image/jpg"

```

To write a content to a temporary file

```
$temp_filename = Files::WriteToTemp($some_content);

```

And so on.

Usage
-----

[](#usage)

### Directory creation

[](#directory-creation)

```
Files::Mkdir("/path/to/a/directory/"); // creates directory "/path/to/a/directory"
Files::Mkdir("/path/to/another/directory"); // creates directory /path/to/another/directory

Files::MkdirForFile("/path/to/a/file"); // creates directory "/path/to/a"

```

### Finding files

[](#finding-files)

```
$all_files_in_a_dir = Files::FindFiles("./dir"); // ["./dir/image.jpg", "./dir/image.png", "./dir/subdir/image2.jpg", "./dir/subdir/readme.txt"]
$files_right_in_a_dir = Files::FindFiles("./dir", ["maxdepth" => 1]); // ["./dir/image.jpg", "./dir/image.png"]

// filtering files
$images = Files::FindFiles("./dir/", ["pattern" => '/\.(png|jpg)$/']); // ["./dir/image.jpg", "./dir/image.png", "./dir/subdir/image2.jpg"]

// finding recently updated log files
$log_files = Files::FindFiles("./log/", [
  "pattern" => '/\.log$/', // only *.log files
  "min_mtime" => time() - 30 * 60 // not older than 30 minutes
 ]);

```

### Temporary files

[](#temporary-files)

```
// by the TEMP constant the temporary directory can be specified
define("TEMP","/path/to/temp/");

echo Files::GetTempDir(); // "/path/to/temp/";

$filename = Files::GetTempFilename(); // "/path/to/to/temp/files_tmp_5e060486c4e507.42603767"
$filename = Files::GetTempFilename("image_scaling"); // "/path/to/temp/image_scaling5e060493067748.51409402";

$filename = Files::WriteToTemp($content); // "/path/to/temp/files_tmp_5e0602ce153bd8.40620979"

```

### File types

[](#file-types)

```
Files::DetermineFileType("path/to/a/file"); // "image/jpeg"

// safe file type determination on just uploaded file
Files::DetermineFileType($_FILES["file"]["tmp_name"],["original_filename" => $_FILES["file"]["name"]]);

```

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

[](#installation)

Use the Composer to install Files.

```
cd path/to/your/project/
composer require atk14/files dev-master

```

Licence
-------

[](#licence)

Files is free software distributed [under the terms of the MIT license](http://www.opensource.org/licenses/mit-license)

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity67

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

Recently: every ~272 days

Total

16

Last Release

564d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6304dffbd91d7a978f98632b0e4e30d662dcdb691daadb1388a58984e98faf5c?d=identicon)[yarri](/maintainers/yarri)

---

Top Contributors

[![yarri](https://avatars.githubusercontent.com/u/974278?v=4)](https://github.com/yarri "yarri (72 commits)")

---

Tags

filefiles

### Embed Badge

![Health badge](/badges/atk14-files/health.svg)

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

###  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)[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)[league/flysystem-sftp-v3

SFTP filesystem adapter for Flysystem.

6129.6M91](/packages/league-flysystem-sftp-v3)[league/flysystem-ziparchive

ZIP filesystem adapter for Flysystem.

1039.3M58](/packages/league-flysystem-ziparchive)

PHPackages © 2026

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