Are there any best practices for configuring zip archives in PHP to ensure cross-platform compatibility?

When creating zip archives in PHP, it is important to set the correct encoding for file names to ensure cross-platform compatibility. This can be achieved by using the ZIPARCHIVE::setOptions method and specifying the ZIPARCHIVE::CREATE flag along with ZIPARCHIVE::OVERWRITE flag. Additionally, it is recommended to use forward slashes (/) as directory separators in file paths to ensure compatibility across different operating systems.

$zip = new ZipArchive();
$zip->open('archive.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE);
$zip->setOptions(['remove_path' => '']);
$zip->addFile('file.txt', 'directory/file.txt');
$zip->close();