{"id":21212566,"url":"https://github.com/aternosorg/php-io","last_synced_at":"2026-02-27T01:05:20.960Z","repository":{"id":262830342,"uuid":"888489856","full_name":"aternosorg/php-io","owner":"aternosorg","description":"PHP library for IO operations","archived":false,"fork":false,"pushed_at":"2025-04-29T12:52:01.000Z","size":197,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-30T00:47:10.871Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/aternos/io","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aternosorg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-11-14T13:43:25.000Z","updated_at":"2025-04-29T12:51:23.000Z","dependencies_parsed_at":"2025-04-29T13:52:10.722Z","dependency_job_id":"9d9ecb7f-eb0d-4ba4-bfa4-398f8bc05732","html_url":"https://github.com/aternosorg/php-io","commit_stats":null,"previous_names":["aternosorg/php-io"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/aternosorg/php-io","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fphp-io","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fphp-io/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fphp-io/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fphp-io/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aternosorg","download_url":"https://codeload.github.com/aternosorg/php-io/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fphp-io/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263033208,"owners_count":23403116,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-20T21:11:04.377Z","updated_at":"2026-02-27T01:05:20.924Z","avatar_url":"https://github.com/aternosorg.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aternos/io\n\nPHP library for IO operations.\n\nThe main goal of this library is to abstract IO operations to make different kind\nof IO elements, e.g. files and streams, interchangeable and allow writing code that\ndoesn't depend on the filesystem, but feature interfaces that can be implemented for \nany kind of IO backend, e.g. network based storages.\n\n## Installation\n\n```bash\ncomposer require aternos/io\n```\n\n## Basic Usage\n\n```php\nuse Aternos\\IO\\System\\File\\File;\nuse Aternos\\IO\\System\\Directory\\Directory;\n\n$file = new File(\"path/to/file.txt\");\n$file-\u003ecreate();\n$file-\u003ewrite(\"Hello World!\");\n$file-\u003esetPosition(0);\necho $file-\u003eread($file-\u003egetSize());\n$file-\u003edelete();\n\n$directory = new Directory(\"path/to/directory\");\nforeach ($directory-\u003egetChildrenRecursive() as $child) {\n    echo $child-\u003egetPath() . PHP_EOL;\n}\n$directory-\u003edelete();\n```\n\n## IO Elements\n\n| Name                   | Class                                                                                                 | Description                                                           |\n|------------------------|-------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------|\n| **File**               | [`Aternos\\IO\\System\\File\\File`](src/System/File/File.php)                                             | Regular filesystem file                                               |\n| **TempDiskFile**       | [`Aternos\\IO\\System\\File\\TempDiskFile`](src/System/File/TempDiskFile.php)                             | Temporary disk file, created and deleted automatically                |\n| **TempMemoryFile**     | [`Aternos\\IO\\System\\File\\TempMemoryFile`](src/System/File/TempMemoryFile.php)                         | Temporary file in memory                                              |\n| **TempMemoryDiskFile** | [`Aternos\\IO\\System\\File\\TempMemoryDiskFile`](src/System/File/TempMemoryDiskFile.php)                 | Temporary file in memory, moved to disk when size exceeds a threshold |\n| **Directory**          | [`Aternos\\IO\\System\\Directory\\Directory`](src/System/Directory/Directory.php)                         | Regular filesystem directory                                          |\n| **TempDirectory**      | [`Aternos\\IO\\System\\Directory\\TempDirectory`](src/System/Directory/TempDirectory.php)                 | Temporary directory, created and deleted automatically                |\n| **FilteredDirectory**  | [`Aternos\\IO\\System\\Directory\\FilteredDirectory`](src/System/Directory/FilteredDirectory.php)         | Directory that filters its children                                   |\n| **Link**               | [`Aternos\\IO\\System\\Link\\Link`](src/System/Link/Link.php)                                             | Generic filesystem link                                               |\n| **FileLink**           | [`Aternos\\IO\\System\\Link\\FileLink`](src/System/Link/FileLink.php)                                     | Filesystem link to a file, can be used like a file                    |\n| **DirectoryLink**      | [`Aternos\\IO\\System\\Link\\DirectoryLink`](src/System/Link/DirectoryLink.php)                           | Filesystem link to a directory, can be used like a directory          |\n| **SocketStream**       | [`Aternos\\IO\\System\\Socket\\Stream\\SocketStream`](src/System/Socket/Stream/SocketStream.php)           | Stream for reading from and writing to sockets                        |\n| **SocketReadStream**   | [`Aternos\\IO\\System\\Socket\\Stream\\SocketReadStream`](src/System/Socket/Stream/SocketReadStream.php)   | Stream for read only sockets                                          |\n| **SocketWriteStream**  | [`Aternos\\IO\\System\\Socket\\Stream\\SocketWriteStream`](src/System/Socket/Stream/SocketWriteStream.php) | Stream for write only sockets                                         |\n\nYou can get the correct IO element from a path using `FilesystemElement::getIOElementFromPath()`.\n\n```php\nuse Aternos\\IO\\System\\FilesystemElement;\n\n$element = FilesystemElement::getIOElementFromPath(\"path/to/element\");\n```\n\n## Interfaces\nYou can and should use the provided interfaces when writing your code to make it more flexible and interchangeable.\n\nThe basic interface for all IO elements is [`Aternos\\IO\\Interfaces\\IOElementInterface`](src/Interfaces/IOElementInterface.php).\n\n### Feature Interfaces\nThe 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.\nAll feature interfaces are listed here: [`src/Interfaces/Features`](src/Interfaces/Features).\n\n#### Example\n```php\nuse Aternos\\IO\\Interfaces\\Features\\ReadInterface;\nuse Aternos\\IO\\Interfaces\\Features\\GetSizeInterface;\n\nfunction readEntireFile(ReadInterface\u0026GetSizeInterface $file): string {\n    return $file-\u003eread($file-\u003egetSize());\n}\n```\n\n### Type Interfaces\nFor convenience, this library also provides type interfaces that combine multiple feature interfaces for common\nIO elements. All type interfaces are listed here: [`src/Interfaces/Types`](src/Interfaces/Types).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faternosorg%2Fphp-io","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faternosorg%2Fphp-io","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faternosorg%2Fphp-io/lists"}