File
![Build Status][]
, (*1)
An extension of SplFileObject
that uses exceptions., (*2)
Usage
You would use this class the exact same way you use SplFileObject
, because
it is SplFileObject
. The only difference is that errors will throw an
exception when they occur., (*3)
use KHerGe\File\File;
$file = new File('example.txt');
$file->fseek(-1);
/*
* Fatal error: Uncaught exception 'KHerGe\File\Exception\FileException' with message 'The file "test.txt" could not be seeked.' in /path/to/file/src/lib/KHerGe/File/Exception/FileException.php on line 157
*
* KHerGe\File\Exception\FileException: The file "test.txt" could not be seeked. in /path/to/file/src/lib/KHerGe/File/Exception/FileException.php on line 157
*
* Call Stack:
* 0.0001 248992 1. {main}() /path/to/file/test.php:0
* 0.0011 382928 2. KHerGe\File\File->fseek() /path/to/file/test.php:6
*/
Exceptions originally thrown by SplFileObject
will also be wrapped in the
FileException
class included with this library., (*4)
Requirements
Installation
Via Composer:, (*5)
$ composer require "kherge/file=dev-master"
I recommend that you install the most recent stable release. You can find one
on Packagist, the GitHub releases page, or the tag list in the Git repository., (*6)
License
This library is available under the MIT license., (*7)