1. Go to this page and download the library: Download indy2kro/php-iso library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
indy2kro / php-iso example snippets
use PhpIso\IsoFile;
$isoFile = new IsoFile('test.iso');
$volume = $isoFile->getPreferredVolume();
foreach ($volume->walk($isoFile) as $entry) {
echo $entry->path, $entry->isDirectory ? '/' : ' (' . $entry->size . ' bytes)', PHP_EOL;
}
$entry = $fileSystem->find($isoFile, '/dir/readme.txt');
if ($entry !== null) {
$content = $fileSystem->readFile($isoFile, $entry); // whole file, limited by IsoFile::MAX_READ_LENGTH
$stream = $fileSystem->openStream($isoFile, $entry); // seekable stream, read from the image on demand
echo fread($stream, 100);
fclose($stream);
}
foreach ($fileSystem->search($isoFile, '*.txt') as $match) {
echo $match->path, PHP_EOL;
}
echo $entry->mode, $entry->uid, $entry->gid; // null when the image has no such information
echo $entry->getSymlinkTarget(); // null unless the entry is a symbolic link
(new \PhpIso\Extractor())->extract($isoFile, $fileSystem, '/tmp/out');
// keep the Rock Ridge permissions and carry on after an unsafe name or a failed write
$extractor = new \PhpIso\Extractor(preserveMode: true, continueOnError: true);
$extractor->extract($isoFile, $fileSystem, '/tmp/out');
print_r($extractor->getErrors()); // entry path => message