I'm using PharData to create a tar package. It works fine but it includes a folder i don't want. How can I exclude a folder in the archive?
<?php
$dir = "/foobar/dir";
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($dir)
);
$phar = new PharData('/mytar.tar');
$phar->buildFromIterator($iterator, $dir);
$phar->compress(Phar::GZ);
unlink(realpath('/mytar.tar'));
The folder I want to ignore in the archive is vendor (/foobar/dir/vendor).