PHPackages                             aternos/io - 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. aternos/io

ActiveLibrary

aternos/io
==========

PHP library for IO operations

v2.0.1(1y ago)041.6k↓38.2%11MITPHPPHP &gt;=8.3.0CI passing

Since Nov 14Pushed 1y ago1 watchersCompare

[ Source](https://github.com/aternosorg/php-io)[ Packagist](https://packagist.org/packages/aternos/io)[ RSS](/packages/aternos-io/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (1)Versions (9)Used By (1)

aternos/io
==========

[](#aternosio)

PHP library for IO operations.

The main goal of this library is to abstract IO operations to make different kind of IO elements, e.g. files and streams, interchangeable and allow writing code that doesn't depend on the filesystem, but feature interfaces that can be implemented for any kind of IO backend, e.g. network based storages.

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

[](#installation)

```
composer require aternos/io
```

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

[](#basic-usage)

```
use Aternos\IO\System\File\File;
use Aternos\IO\System\Directory\Directory;

$file = new File("path/to/file.txt");
$file->create();
$file->write("Hello World!");
$file->setPosition(0);
echo $file->read($file->getSize());
$file->delete();

$directory = new Directory("path/to/directory");
foreach ($directory->getChildrenRecursive() as $child) {
    echo $child->getPath() . PHP_EOL;
}
$directory->delete();
```

IO Elements
-----------

[](#io-elements)

NameClassDescription**File**[`Aternos\IO\System\File\File`](src/System/File/File.php)Regular filesystem file**TempDiskFile**[`Aternos\IO\System\File\TempDiskFile`](src/System/File/TempDiskFile.php)Temporary disk file, created and deleted automatically**TempMemoryFile**[`Aternos\IO\System\File\TempMemoryFile`](src/System/File/TempMemoryFile.php)Temporary file in memory**TempMemoryDiskFile**[`Aternos\IO\System\File\TempMemoryDiskFile`](src/System/File/TempMemoryDiskFile.php)Temporary file in memory, moved to disk when size exceeds a threshold**Directory**[`Aternos\IO\System\Directory\Directory`](src/System/Directory/Directory.php)Regular filesystem directory**TempDirectory**[`Aternos\IO\System\Directory\TempDirectory`](src/System/Directory/TempDirectory.php)Temporary directory, created and deleted automatically**FilteredDirectory**[`Aternos\IO\System\Directory\FilteredDirectory`](src/System/Directory/FilteredDirectory.php)Directory that filters its children**Link**[`Aternos\IO\System\Link\Link`](src/System/Link/Link.php)Generic filesystem link**FileLink**[`Aternos\IO\System\Link\FileLink`](src/System/Link/FileLink.php)Filesystem link to a file, can be used like a file**DirectoryLink**[`Aternos\IO\System\Link\DirectoryLink`](src/System/Link/DirectoryLink.php)Filesystem link to a directory, can be used like a directory**SocketStream**[`Aternos\IO\System\Socket\Stream\SocketStream`](src/System/Socket/Stream/SocketStream.php)Stream for reading from and writing to sockets**SocketReadStream**[`Aternos\IO\System\Socket\Stream\SocketReadStream`](src/System/Socket/Stream/SocketReadStream.php)Stream for read only sockets**SocketWriteStream**[`Aternos\IO\System\Socket\Stream\SocketWriteStream`](src/System/Socket/Stream/SocketWriteStream.php)Stream for write only socketsYou can get the correct IO element from a path using `FilesystemElement::getIOElementFromPath()`.

```
use Aternos\IO\System\FilesystemElement;

$element = FilesystemElement::getIOElementFromPath("path/to/element");
```

Interfaces
----------

[](#interfaces)

You can and should use the provided interfaces when writing your code to make it more flexible and interchangeable.

The basic interface for all IO elements is [`Aternos\IO\Interfaces\IOElementInterface`](src/Interfaces/IOElementInterface.php).

### Feature Interfaces

[](#feature-interfaces)

The feature interfaces define specific features that an IO element can have, e.g. reading or writing. You should limit the required type in your code to the specific features that you need. All feature interfaces are listed here: [`src/Interfaces/Features`](src/Interfaces/Features).

#### Example

[](#example)

```
use Aternos\IO\Interfaces\Features\ReadInterface;
use Aternos\IO\Interfaces\Features\GetSizeInterface;

function readEntireFile(ReadInterface&GetSizeInterface $file): string {
    return $file->read($file->getSize());
}
```

### Type Interfaces

[](#type-interfaces)

For convenience, this library also provides type interfaces that combine multiple feature interfaces for common IO elements. All type interfaces are listed here: [`src/Interfaces/Types`](src/Interfaces/Types).

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance48

Moderate activity, may be stable

Popularity29

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.5% 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 ~23 days

Total

8

Last Release

384d ago

Major Versions

v1.2.2 → v2.0.02025-04-08

### Community

Maintainers

![](https://www.gravatar.com/avatar/182e603c02f308d1036a1ecaba0b994665e87d13a86ff4550a96c9189a92c544?d=identicon)[aternos](/maintainers/aternos)

---

Top Contributors

[![matthi4s](https://avatars.githubusercontent.com/u/8943286?v=4)](https://github.com/matthi4s "matthi4s (65 commits)")[![KurtThiemann](https://avatars.githubusercontent.com/u/26512466?v=4)](https://github.com/KurtThiemann "KurtThiemann (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aternos-io/health.svg)

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

PHPackages © 2026

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