dev-master
9999999-devStream Wrapper for ISO9660 files (.iso files)
MIT
The Requires
- php ^7.1
- symfony/polyfill-mbstring ^1.8
The Development Requires
iso iso9660 9660 cdrom joliet rock-ridge
Stream Wrapper for ISO9660 files (.iso files)
PHP Stream Wrapper for ISO9660 files (.iso files), (*1)
Install using Composer:, (*3)
$ composer require vdechenaux/iso-9660
Register the Stream Wrapper:, (*4)
\ISO9660\StreamWrapper::register();
Use it, with any function which supports stream wrappers:, (*5)
// Get the content file_get_contents('iso9660://path/myIsoFile.iso#song.mp3'); // Get the size filesize('iso9660://path/myIsoFile.iso#song.mp3'); // Check if ISO file contains a file file_exists('iso9660://path/myIsoFile.iso#song.mp3'); // List files $iterator = new RecursiveTreeIterator(new RecursiveDirectoryIterator('iso9660://myIsoFile.iso#')); foreach ($iterator as $entry) { echo $entry.PHP_EOL; } // Get a stream on a file contained in the ISO file // Here, a PNG file $stream = fopen('iso9660://myIsoFile.iso#image.png', 'r'); fseek($stream, 1); // Skip 1st byte $header = fread($stream, 3); // We should get "PNG" // Etc...
You must separate the iso file and the internal path with a #
, even if the right part is empty, like in above examples., (*6)
You can use the \ISO9660\Reader
class if you don't want to use native PHP functions., (*7)
You can configure some behaviors of the reader:
- showHiddenFiles
(boolean, default: false
) Set it to true
to see/read hidden files., (*8)
To use options, you have to do something like this:, (*9)
$opts = [ 'iso9660' => [ 'showHiddenFiles' => true, ] ]; $context = stream_context_create($opts); file_get_contents('iso9660:///tmp/file.iso#hidden.mp3', false, $context);
If you are using the \ISO9660\Reader
class, you can use theses options by passing an \ISO9660\ReaderOptions
object to the constructor., (*10)
As this package is an ISO9660 implementation, you can directly read an optical drive by doing something like this:, (*11)
$iterator = new RecursiveTreeIterator(new RecursiveDirectoryIterator('iso9660:///dev/cdrom#')); foreach ($iterator as $entry) { echo $entry.PHP_EOL; }
By using /dev/cdrom
instead of an ISO file, you can directly interact with the hardware, without mounting the disc in the OS., (*12)
CE
Continuation AreaSP
System Use Sharing Protocol IndicatorER
Extensions Reference (supported types: RRIP_1991A
, IEEE_P1282
, IEEE_1282
)CL
Child linkPL
Parent linkNM
Alternate namePX
POSIX file attributesRE
Relocated directoryRR
Rock Ridge extensions in-use indicatorSL
Symbolic linkTF
Time stamp(s) for a fileWhy not ? 🤷♂️, (*13)
I made it only for fun. I hope someone will find a usage 😁, (*14)
This project is released under the MIT license., (*15)
Stream Wrapper for ISO9660 files (.iso files)
MIT
iso iso9660 9660 cdrom joliet rock-ridge