2017 © Pedro Peláez
 

library simple-file-handler

Simple file handler. Uses generators.

image

guiguiboy/simple-file-handler

Simple file handler. Uses generators.

  • Thursday, April 6, 2017
  • by guiguiboy
  • Repository
  • 1 Watchers
  • 1 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Simple file handler

This is a simple library which uses PHP generators to read a file. Think of it as a replacement for the built-in file() function which creates a copy of the file in the memory, thus making it unsuitable for large files., (*1)

Getting Started

As long as the FileHandler class is autoloaded, simply:, (*2)

$streamHandler = new StreamHandler(__DIR__ . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'file.txt');

foreach ($streamHandler->getLines() as $line) {
    //Do what you want
}

A check is made in the constructor to ensure provided file path exists. If not, an \InvaliDArgumentException would be thrown., (*3)

Prerequisites

  • Composer

Installing

  • Add package to your deps with composer
composer require guiguiboy/simple-file-handler
  • Enjoy

Running the tests

  • Tests
vendor/bin/phpunit tests/

And coding style tests

  • PSR-2 compatibility
vendor/bin/phpcs --standard=psr2 --ignore=vendor .

Contributing

Please, make PR. I'll be happy to review., (*4)

Versioning

Authors

  • Guillaume BRETOU

License

This project is licensed under the MIT License - see the LICENSE.md file for details, (*5)

Acknowledgments

  • README built with https://gist.github.com/PurpleBooth/109311bb0361f32d87a2

The Versions

06/04 2017

dev-master

9999999-dev

Simple file handler. Uses generators.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Guigui

06/04 2017

0.1.1

0.1.1.0

Simple file handler. Uses generators.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Guigui

06/04 2017

0.1.0

0.1.0.0

Simple file handler. Uses generators.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Guigui