Coder Social home page Coder Social logo

php-filesystem's Introduction

php-filesystem

This librairy is a set of functions to ease filesystem operations and manipulations

Build Status

Coverage Status

Install

Install package with composer

composer require hugsbrugs/php-filesystem

In your PHP code, load librairy

require_once __DIR__ . '/../vendor/autoload.php';
use Hug\FileSystem\FileSystem as FileSystem;

Usage

List files in a directory optionnaly filter by extension (. and .. are removed from response)

FileSystem::scandir_h($directory, $file_extension = null);

Remove files recursively in a directory

FileSystem::rrmdir($dir, $del_dir = TRUE);

Recursively copy files and folder to destination and creates directory structure if necessary

FileSystem::rcopy($source, $dest, $permissions = 0755);

Writes data in a file and creates directories if necessary

FileSystem::force_file_put_contents($filename, $data, $flags = 0, $context = null);

List files in a directory with options

FileSystem::list_dir($dir, $return_type = 'ALL', $return_format = 'FULL');

Get file last modification date in desired date format

FileSystem::file_last_mod($file_path, $date_format = 'Y-m-d H:i:s');

Get file size

FileSystem::file_size($FilePath);

Get bunch of informations about file list

FileSystem::get_file_list_infos($files);

Get a human readable file size

FileSystem::human_file_size($size, $unit = '');

Converts a file size in bytes in a human readable way

FileSystem::get_symbol_by_quantity($bytes);

Get a directory size

FileSystem::dir_size($directory);

Get disk usage

FileSystem::get_disk_usage($path);

Delete files in a directory older than a given date

FileSystem::remove_older_files($directory, $date_interval = 'P8D', $get_results = false, $test_mode = false);

Compares two files for eqality

FileSystem::are_files_equal($file_a, $file_b);

Get unix file permissions

FileSystem::unix_file_permissions($path);

Author

Hugo Maugey visit my website ;)

php-filesystem's People

Contributors

hugsbrugs avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.