The ->setPassword() method is not setting the password for the archive you are making; it's just setting the password to use to extract files when reading a zip archive.
As noted in this comment https://www.php.net/manual/en/ziparchive.setpassword.php#122465 the correct way to create a password protected zip file is to use ->setEncryptionName('test.txt', ZipArchive::EM_AES_256, 'passw0rd'); on each file entry.
This is currently not possible on Madzipper because the repository is not giving public access to the ZipArchive instance.
The
->setPassword()method is not setting the password for the archive you are making; it's just setting the password to use to extract files when reading a zip archive.As noted in this comment https://www.php.net/manual/en/ziparchive.setpassword.php#122465 the correct way to create a password protected zip file is to use
->setEncryptionName('test.txt', ZipArchive::EM_AES_256, 'passw0rd');on each file entry.This is currently not possible on Madzipper because the repository is not giving public access to the
ZipArchiveinstance.