PHP Classes

PHP File Access: Access and manipulate files

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 82 All time: 9,881 This week: 263Up
Version License PHP version Categories
php-file-access 1.0Custom (specified...5PHP 5, Files and Folders
Description Author

This package can access and manipulate files.

It provides a PHP iteration that acts like an array and also counts file elements that it contains by sorting or modifying the files.

The class main goal is to act as an alternative to the PHP file function by providing more delimiter options.

Picture of zinsou A.A.E.Mo´se
  Performance   Level  
Name: zinsou A.A.E.Mo´se is available for providing paid consulting. Contact zinsou A.A.E.Mo´se .
Classes: 50 packages by
Country: Benin Benin
Age: 32
All time rank: 7051 in Benin Benin
Week rank: 46 Up1 in Benin Benin Equal
Innovation award
Innovation award
Nominee: 23x

Winner: 2x

FileAccess is a seek-able countable PHP Iterator that acts too in part like
an ArrayObject.It meanly act as a read only ArrayObject that can't be sorted or modify.
Its main goal is to act as a flexible and inexpensive alternative to the PHP file function 
providing more delimiter options.It actually have all the read-only file functions
and can help  to iterate on a chosen format of file's chunks. 

class FileAccess implements SeekableIterator,countable,ArrayAccess
    public function __construct(string $fileName,string|integer|float $delimiter='\n',int $flags=0,resource $context=null)  $delimiter can be a POSIX regex
    public function rewind() 
    public function valid() 
    public function current() 
    public function key() 
    public function next()
	public function prev()
	public function eof()
	public function end()
	public function count()
	public function offsetExists(int $offset)
	public function offsetGet(int $offset)
	public function offsetSet(int $offset,mixed $value)
	public function offsetUnset(int $offset)
	public function seek(int $offset)
	public function ftell()
	public function fseek(int $offset,int $whence=SEEK_SET)
	public function fread(int $length)
	public function fgets(int $length=null)
	public function fgetc()
	public function fgetss(int $length=null,string $allowable_tags='')
	public function fscanf(string $format,&...$facultatives)   Only for  PHP >=5.6.0,open the class file and comment this method lines 
														if you use PHP < 5.6  

	public function fgetcsv(int $length = 0 ,string $delimiter = "," ,string  $enclosure = '"' ,string $escape = "\\" )
	public function reset()

	public function fpassthru(

	public function Filter_FileAccess()  only usefull to act like PHP "file" function : filter with defined flags when $delimiter=='\n'
	                                     and return unfiltered data when !='\n'
	public function getArrayCopy()   return an array containing the iterator values(eg: when $delimiter is \n then the array will be the
	                                 same as the PHP file function output without flags skip_empty_lines and ignore_new_line
	public function fstat()
	public function length 
	public function max_chunk_length()

	public function getMoreInfos()  return new SplFileInfo object

	public function getMoreOptions(string $mode="rb",boolean $use_include_path=false) return new SplFileObject object with read only mode

	public function getMimeType()

	public function getSha1(boolean $raw_output=false)

	public function getMd5(boolean $raw_output=false)
	public function __toString()
	public function __destruct() 


report  bugs and improvements to  or simply use the dedicated forum.
  Files folder image Files  
File Role Description
Plain text file FileAccess.class.php Class class source
Accessible without login Plain text file license.txt Lic. license file
Accessible without login Plain text file readme.txt Doc. readme
Accessible without login Plain text file testFileAccess.php Example example script

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,881
This week:263Up
For more information send a message to info at phpclasses dot org.