Skip to content

selective-php/rar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c4b043a · Sep 9, 2023

History

27 Commits
Sep 9, 2023
May 30, 2023
Sep 9, 2023
Sep 9, 2023
Sep 9, 2023
Sep 9, 2023
Sep 9, 2023
Sep 9, 2023
Sep 9, 2023
May 30, 2023
Sep 9, 2023
Sep 9, 2023
Sep 9, 2023
Sep 9, 2023
Sep 9, 2023

Repository files navigation

selective/rar

RAR file reader for PHP.

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Features

  • Read RAR file information
  • RAR 5 archive format
  • RAR 4 archive format
  • No dependencies
  • Very fast

Note: This package does not support extracting / unpacking rar archives.

Requirements

  • PHP 8.1+

The PECL RAR package is NOT required

Installation

composer require selective/rar

Usage

Open RAR file

use Selective\Rar\RarFileReader;
use SplFileObject;

$rarFileReader = new RarFileReader();
$rarArchive = $rarFileReader->openFile(new SplFileObject('test.rar'));

foreach ($rarArchive->getEntries() as $entry) {
    echo $entry->getName() . "\n";
}

Open in-memory RAR file

use Selective\Rar\RarFileReader;
use SplTempFileObject;

$file = new SplTempFileObject();
$file->fwrite('my binary rar content');

$rarFileReader = new RarFileReader();
$rarArchive = $rarFileReader->openFile($file);

foreach ($rarArchive->getEntries() as $entry) {
    echo $entry->getName() . "\n";
}

License

The MIT License (MIT). Please see License File for more information.