isLink() || !in_array($entry->getExtension(), ['php', 'js', 'css', 'ttf', 'svg', 'png', 'ico', 'webmanifest', 'html'], true)) { throw new RuntimeException('Unexpected deployment file: ' . $entry->getFilename()); } $files[] = substr($entry->getPathname(), strlen(base_path()) + 1); } } sort($files, SORT_STRING); $zip = new ZipArchive(); if ($zip->open(base_path('dist/madar-cpanel.zip'), ZipArchive::CREATE | ZipArchive::OVERWRITE) !== true) { throw new RuntimeException('Could not create archive.'); } foreach ($files as $file) { if (!$zip->addFile(base_path($file), $file)) { throw new RuntimeException('Could not package: ' . $file); } } if (!$zip->close()) { throw new RuntimeException('Could not finalize archive.'); } echo "Created dist/madar-cpanel.zip — set the document root to public/. No credentials included.\n";