2017 © Pedro Peláez
 

library file

PHP library for file management.

image

josantonius/file

PHP library for file management.

  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 9 Versions
  • 8 % Grown

The README.md

PHP File library

Latest Stable Version License, (*1)

Versión en español, (*2)

PHP library for file management., (*3)



Requirements

This library is supported by PHP versions 5.6 or higher and is compatible with HHVM versions 3.0 or higher., (*4)

Installation

The preferred way to install this extension is through Composer., (*5)

To install PHP File library, simply:, (*6)

composer require Josantonius/File

The previous command will only install the necessary files, if you prefer to download the entire source code you can use:, (*7)

composer require Josantonius/File --prefer-source

You can also clone the complete repository with Git:, (*8)

$ git clone https://github.com/Josantonius/PHP-File.git, (*9)

Or install it manually:, (*10)

Download File.php:, (*11)

wget https://raw.githubusercontent.com/Josantonius/PHP-File/master/src/File.php

Available Methods

Available methods in this library:, (*12)

- Check if a file exists in a path or url

File::exists($file);
Attribute Description Type Required Default
$file Path or file url. string Yes

# Return (boolean), (*13)

- Delete file if exists

File::delete($file);
Attribute Description Type Required Default
$file File path. string Yes

# Return (boolean), (*14)

- Create directory if not exists

File::createDir($path);
Attribute Description Type Required Default
$path Path where to create directory. string Yes

# Return (boolean), (*15)

- Copy directory recursively

File::copyDirRecursively($from, $to);
Attribute Description Type Required Default
$from Path from copy. string Yes
$to Path to copy. string Yes

# Return (boolean), (*16)

- Delete empty directory

File::deleteEmptyDir($path);
Attribute Description Type Required Default
$path Path to delete. string Yes

# Return (boolean), (*17)

- Delete directory recursively

File::deleteDirRecursively($path);
Attribute Description Type Required Default
$path Path to delete. string Yes

# Return (boolean), (*18)

- Get files from directory

File::getFilesFromDir($path);
Attribute Description Type Required Default
$path Path where get file paths. string Yes

# Return (boolean), (*19)

Quick Start

To use this library with Composer:, (*20)

require __DIR__ . '/vendor/autoload.php';

use Josantonius\File\File;

Or If you installed it manually, use it:, (*21)

require_once __DIR__ . '/File.php';

use Josantonius\File\File;

Usage

Example of use for this library:, (*22)

- Check if a local file exists

File::exists('path/to/file.php');

- Check if a external file exists

File::exists('https://raw.githubusercontent.com/Josantonius/PHP-File/master/composer.json');

- Delete a local file

File::delete(__DIR__ . '/test.txt');

- Create directory

File::createDir(__DIR__ . '/test/');

- Delete empty directory

File::deleteEmptyDir(__DIR__ . '/test/');

- Delete directory recursively

File::deleteDirRecursively(__DIR__ . '/test/');

- Copy directory recursively

File::copyDirRecursively(__DIR__ . '/test/', __DIR__ . '/copy/');

- Get file paths from directory

get_class(File::getFilesFromDir(__DIR__));

Tests

To run tests you just need composer and to execute the following:, (*23)

git clone https://github.com/Josantonius/PHP-File.git

cd PHP-File

composer install

Run unit tests with PHPUnit:, (*24)

composer phpunit

Run PSR2 code standard tests with PHPCS:, (*25)

composer phpcs

Run PHP Mess Detector tests to detect inconsistencies in code style:, (*26)

composer phpmd

Run all previous tests:, (*27)

composer tests

License

This repository is licensed under the MIT License., (*28)

Copyright © 2017 - 2022, Josantonius, (*29)

The Versions

06/01 2018

dev-master

9999999-dev

PHP library for file management.

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

file php strings hhvm search words in file file handler

06/01 2018

1.1.7

1.1.7.0

PHP library for file management.

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

file php strings hhvm search words in file file handler

12/11 2017

1.1.6

1.1.6.0

PHP library for file management.

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

file php strings hhvm search words in file file handler

30/10 2017

1.1.5

1.1.5.0

PHP library for file management.

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

file php strings hhvm search words in file file handler

12/10 2017

1.1.4

1.1.4.0

PHP library for file management.

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

file php strings hhvm search words in file file handler

03/09 2017

1.1.3

1.1.3.0

PHP library for file management.

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

file php strings hhvm search words in file file handler

18/07 2017

1.1.2

1.1.2.0

PHP library for file management.

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

file php strings hhvm search words in file file handler

18/03 2017

1.1.1

1.1.1.0

PHP library for file management.

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

file php strings hhvm search words in file file handler

17/01 2017

1.0.0

1.0.0.0

PHP library for file management.

  Sources   Download

MIT

The Requires

  • php >=7.0

 

file php strings hhvm search words in file file handler