PHPackages                             10quality/wp-file - 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. 10quality/wp-file

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

10quality/wp-file
=================

Small class library that facilitates file handling in WordPress.

v1.0.0(3y ago)26.8k12MITPHPPHP &gt;=5.2CI failing

Since Sep 21Pushed 3y ago2 watchersCompare

[ Source](https://github.com/10quality/wp-file)[ Packagist](https://packagist.org/packages/10quality/wp-file)[ RSS](/packages/10quality-wp-file/feed)WikiDiscussions v1.0 Synced today

READMEChangelog (6)Dependencies (1)Versions (8)Used By (2)

WordPress File (wrapper class)
==============================

[](#wordpress-file-wrapper-class)

[![Latest Stable Version](https://camo.githubusercontent.com/5d12b9b10a0b2a03457fdcb2ad06947fb12347f4782af73227a1a181c42fe424/68747470733a2f2f706f7365722e707567782e6f72672f31307175616c6974792f77702d66696c652f762f737461626c65)](https://packagist.org/packages/10quality/wp-file)[![Total Downloads](https://camo.githubusercontent.com/880cae7e144665c1f23015d156a0adb70cdfefeb655bf1babe759c64a9b9c825/68747470733a2f2f706f7365722e707567782e6f72672f31307175616c6974792f77702d66696c652f646f776e6c6f616473)](https://packagist.org/packages/10quality/wp-file)[![License](https://camo.githubusercontent.com/3dc82930cbe69c40ffbb27c797fc7bbffdf5fbea963b26893dea6af135d019cd/68747470733a2f2f706f7365722e707567782e6f72672f31307175616c6974792f77702d66696c652f6c6963656e7365)](https://packagist.org/packages/10quality/wp-file)

This small class library facilitates file handling for WordPress custom developments, will provide all functionality to meet WordPress' standards.

Features:

- **Theme Check** ready.
- Easy to use.

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

[](#installation)

### With composer

[](#with-composer)

Make the dependecy required in your project:

```
composer require 10quality/wp-file
```

### Alternative

[](#alternative)

Download or clone the project and load the class with php functions:

```
require_once '[PATH TO CLASS]/File.php';
```

Usage
-----

[](#usage)

The following example will let you see how to use the class:

Code to replace

```
$filename = __DIR__.'/myfile.txt';

$file = @fopen( $filename, ,'w+' );

$content = fread( $file );

fwrite( $file, $content );

fclose($file);
```

Replacement:

```
use TenQuality\WP\File;

$filename = __DIR__.'/myfile.txt';

$content = File::auth()->read( $filename );

File::auth()->write( $filename, $content );
```

### Authentication

[](#authentication)

WordPress will require to authenticate a url in order to validate if filesystem credentials are in place.

If you need to authenticate a specific url, pass it like this:

```
File::auth( $url )->read( $filename );
```

### Other methods

[](#other-methods)

```
// Returns bool
$isFile = File::auth()->is_file( $filename );
// Returns bool
$fileExists = File::auth()->exists( $filename );
```

### Folder or Path handling

[](#folder-or-path-handling)

Methods to handle files:

```
$file = File::auth();

// Use is_dir to check if a path exists or not.
if ( $file->is_dir( $path ) )
    // Use mkdir to create non-existent paths.
    $file->mkdir( $path );
// Use rmdir to remove paths.
$file->rmdir( $path );
```

### Recomendations

[](#recomendations)

Store your files in the `uploads` folder.

Coding guidelines
-----------------

[](#coding-guidelines)

PSR-4.

LICENSE
-------

[](#license)

The MIT License (MIT)

Copyright (c) 2016 [10Quality](http://www.10quality.com).

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 91.7% 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 ~382 days

Recently: every ~565 days

Total

7

Last Release

1276d ago

Major Versions

v0.9.4 → v1.0.02023-01-05

### Community

Maintainers

![](https://www.gravatar.com/avatar/f2cdad4e398292477582ba8ec4ab02a96fa645cd620518a5bcf697cd788c96c3?d=identicon)[amostajo](/maintainers/amostajo)

---

Top Contributors

[![amostajo](https://avatars.githubusercontent.com/u/1645908?v=4)](https://github.com/amostajo "amostajo (11 commits)")[![garretthyder](https://avatars.githubusercontent.com/u/8726005?v=4)](https://github.com/garretthyder "garretthyder (1 commits)")

---

Tags

filesystemwordpressfile

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/10quality-wp-file/health.svg)

```
[![Health](https://phpackages.com/badges/10quality-wp-file/health.svg)](https://phpackages.com/packages/10quality-wp-file)
```

###  Alternatives

[league/flysystem

File storage abstraction for PHP

13.6k679.9M2.5k](/packages/league-flysystem)[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.7k285.7M1.0k](/packages/league-flysystem-aws-s3-v3)[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k41.5M133](/packages/knplabs-gaufrette)[league/flysystem-webdav

WebDAV filesystem adapter for Flysystem.

762.5M71](/packages/league-flysystem-webdav)[league/flysystem-async-aws-s3

AsyncAws S3 filesystem adapter for Flysystem.

2812.1M44](/packages/league-flysystem-async-aws-s3)[internal/path

Type-safe, immutable file path library with cross-platform support and automatic normalization.

12117.0k11](/packages/internal-path)

PHPackages © 2026

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