High level abstraction to work with files and sockets in a declarative way.
composer require innmind/io
use Innmind\IO\IO;
use Innmind\Url\Path;
use Innmind\Immutable\Str;
$chunks = IO::fromAmbienAuthority()
->files()
->read(Path::of('/some/file.ext'))
->toEncoding(Str\Encoding::ascii)
->chunks(8192); // max length of each chunk
The $chunks
variable is a Innmind\Innmutable\Sequence
containing Innmind\Immutable\Str
values, where each value is of a maximum length of 8192
bytes.
Full documentation can be found at https://innmind.org/io/.