lkt/file-reader

A simple file reader. PHP 8.1+

1.0.0 2022-12-16 11:44 UTC

This package is auto-updated.

Last update: 2024-09-24 14:17:39 UTC


README

This is a fork of chillerlan/php-filereader.

It was forked as soon I realize chillerlan/php-filereader last update was 4 years ago.

I like this package, and now supports php 8.1

chillerlan/php-filereader

A simple file/directory reader for all (well, most... ok. some.) of your file-reading needs.

version license Travis Coverage Scrunitizer Packagist downloads PayPal donate

Requirements

  • PHP 8.1+

Documentation

Installation

requires composer

composer.json

(note: replace dev-master with a version boundary)

{
	"require": {
		"php": ">=7.2.0",
		"chillerlan/database": "dev-master"
	}
}

Manual installation

Download the desired version of the package from master or release and extract the contents to your project folder. After that:

  • run composer install to install the required dependencies and generate /vendor/autoload.php.
  • if you use a custom autoloader, point the namespace chillerlan\Filereader to the folder src of the package

Profit!

Usage

simple

You can just invoke one a FSDriverInterface and use it right away:

use chillerlan\Filereader\Drivers\DiskDriver;

$filereader = new DiskDriver;
$filereader->isDir('/some/path');

advanced

$directory = new Directory($filereader, '/some/path');

/** @var \chillerlan\Filereader\File $file */
foreach($directory->read() as $file){
	echo $file->name;
	// ...
}

API

FSDriverInterface methods

Directory public methods

File public methods

common magic properties of Directory and File

additional magic properties of File