okapi/filesystem

PHP Filesystem is a PHP library that provides an abstraction layer for the filesystem.

1.0.0 2023-02-18 14:35 UTC

This package is auto-updated.

Last update: 2024-12-18 18:31:23 UTC


README

PHP Path

License: MIT Twitter: @WalterWoshid PHP: >=8.0 Packagist Build

Coverage - PHP 8.0 Coverage - PHP 8.1 Coverage - PHP 8.2

PHP Filesystem is a PHP library that provides an abstraction layer for the filesystem.

It is based on Node.js's filesystem module.

Installation

composer require okapi/filesystem

Usage

<?php

use Okapi\Filesystem\Filesystem;

// Write file
Filesystem::writeFile('./path/to/file.txt', 'Hello World!');


// Read file
$contents = Filesystem::readFile('./path/to/file.txt');


// Remove directory or file
Filesystem::rm(
    './path',
    recursive: true,
    force: true,
);

// Create directory
Filesystem::mkdir(
    './path/to/directory',
    recursive: true,
    mode: 0777,
);

Testing

  • Run composer run-script test
    or
  • Run composer run-script test-coverage

Show your support

Give a ⭐ if this project helped you!

📝 License

Copyright © 2023 Valentin Wotschel.
This project is MIT licensed.