xy2z/philer

Handle single file operations

0.3.1 2017-11-25 21:32 UTC

This package is auto-updated.

Last update: 2024-10-29 05:17:07 UTC


README

Installation

Install the latest version with Composer. PHP 7.0 or above is required.

$ composer require xy2z/philer

Basic Usage

use xy2z\Philer\Philer;

$philer = new Philer('list.txt');
$philer->write(3.14);
$philer->write(array('a', 'b', 'c'));
echo $philer->read();
/* Result:
3.14
Array
(
    [0] => a
    [1] => b
    [2] => c
)
*/


// Load a new file and change options
$philer->load('new-list.txt');
$philer->set_option('var_dump', true);
$philer->write(3.14);
$philer->write(array('a', 'b', 'c'));
/* Result in 'new-list.txt':
float(3.14)
array(3) {
  [0]=>
  string(1) "a"
  [1]=>
  string(1) "b"
  [2]=>
  string(1) "c"
}
*/

Options