Reputation: 132
Does PHP have an extension that permits to use a tar.gz like a folder?
I have some file that uses a similar structure and I don't need to extract all to read information about it, so can I make file_get_contents("my/path/to/tar/something.tar.gz/out.json");
?
Upvotes: 7
Views: 229
Reputation: 19466
Use PHP's Phar extension. For an introduction, see PHP: Using Phar Archives: Introduction.
file_get_contents("phar://my/path/to/tar/something.tar.gz/out.json");
If you don't already have Phar, you can install the PHP_Archive package or use the PECL extension.
Upvotes: 3