RAR libraries for PHP
For PHP, the rar extension is the only real option. It’s a C extension with RARLAB’s UnRAR library bundled, so it opens every RAR file: RAR4 and RAR5, encrypted files and headers, volumes. It gives you RarArchive and RarEntry classes and a rar:// stream wrapper that lets fopen, file_get_contents and directory functions read inside an archive. It isn’t bundled with PHP: install it with PECL or PIE.
ZipArchive and PharData, which ship with PHP, don’t read RAR.
- rar extension The PHP rar extension reads RAR4 and RAR5 archives with RarArchive, RarEntry and the rar:// stream wrapper. How to install it, list and extract files.