{"id":3467,"date":"2018-09-06T18:25:46","date_gmt":"2018-09-06T18:25:46","guid":{"rendered":"https:\/\/www.codexworld.com\/?p=3467"},"modified":"2025-06-16T15:09:11","modified_gmt":"2025-06-16T15:09:11","slug":"create-zip-file-using-php","status":"publish","type":"post","link":"https:\/\/www.codexworld.com\/create-zip-file-using-php\/","title":{"rendered":"Create ZIP File using PHP"},"content":{"rendered":"<p>The ZIP is a commonly used file format to archive files with data compression. When you want to allow the user to download multiple folders and files at once from the server, you need to <b>create a ZIP file<\/b> on the fly. It helps to compress files and create an archive to download multiple files at once. The ZIP file can be created dynamically using PHP, and the archive file can be saved on the server from the PHP script easily.<\/p>\n<p>Creating a ZIP archive from the directory can be easily implemented using PHP. The ZipArchive class in PHP provides an instant ability to compress files or folders into a ZIP file. You can archive the entire directory recursively to a ZIP file using PHP. In this tutorial, we will show you how to <b>create ZIP file from a folder using PHP<\/b>.<\/p>\n<h2>ZIP Extension<\/h2>\n<p>The <code>zip<\/code> extension must be installed and enabled on the server to make this script work. Check whether the following line is available in the php.ini configuration file. If already present in the php.ini, remove the semicolon to enable the ZIP extension.<\/p>\n<pre><span class=\"hljs-attribute\" style=\"font-weight: 700;\">extension<\/span>=zip<\/pre>\n<p>You can also check the availability of the ZIP extension on your server by running the <code>phpinfo()<\/code> command on the browser.<\/p>\n<div class=\"img_center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/09\/enable-zip-extension-php-ini-phpinfo-codexworld.png\" alt=\"enable-zip-extension-php-ini-phpinfo-codexworld\" width=\"1207\" height=\"335\" class=\"alignnone size-full wp-image-5797\" srcset=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/09\/enable-zip-extension-php-ini-phpinfo-codexworld.png 1207w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/09\/enable-zip-extension-php-ini-phpinfo-codexworld-300x83.png 300w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/09\/enable-zip-extension-php-ini-phpinfo-codexworld-1024x284.png 1024w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/09\/enable-zip-extension-php-ini-phpinfo-codexworld-768x213.png 768w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/09\/enable-zip-extension-php-ini-phpinfo-codexworld-350x97.png 350w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/09\/enable-zip-extension-php-ini-phpinfo-codexworld-320x89.png 320w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/09\/enable-zip-extension-php-ini-phpinfo-codexworld-380x105.png 380w\" sizes=\"auto, (max-width: 1207px) 100vw, 1207px\" \/><\/div>\n<h2>ZipArchiver Class<\/h2>\n<p>The ZipArchiver is a custom PHP class that helps to create a ZIP file from folder (files and sub-directories) on the server using the <b>ZIP extension<\/b>.<\/p>\n<ul class=\"bullet_disk_list\">\n<li><b>zipDir()<\/b> &#8211; This function creates a Zip of a folder recursively including the parent directory.\n<ul>\n<li><code>$sourcePath<\/code> &#8211; Relative path of the directory to be zipped.<\/li>\n<li><code>$outZipPath<\/code> &#8211; Path to save the zip file.<\/li>\n<\/ul>\n<\/li>\n<li><b>dirToZip()<\/b> &#8211; It is a helper function of ZipArchiver class that adds files and sub-directories in a folder to the zip file.<\/li>\n<\/ul>\n<pre><span style=\"color: #0000BB\">&lt;?php<br \/><\/span><span style=\"color: #007700\">Class&nbsp;<\/span><span style=\"color: #0000BB\">ZipArchiver&nbsp;<\/span><span style=\"color: #007700\">{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/**<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Zip&nbsp;a&nbsp;folder&nbsp;(including&nbsp;itself).<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Usage:<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Folder&nbsp;path&nbsp;that&nbsp;should&nbsp;be&nbsp;zipped.<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;$sourcePath&nbsp;string&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Relative&nbsp;path&nbsp;of&nbsp;directory&nbsp;to&nbsp;be&nbsp;zipped.<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;$outZipPath&nbsp;string&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Path&nbsp;of&nbsp;output&nbsp;zip&nbsp;file.&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">public&nbsp;static&nbsp;function&nbsp;<\/span><span style=\"color: #0000BB\">zipDir<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$sourcePath<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$outZipPath<\/span><span style=\"color: #007700\">){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$pathInfo&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">pathinfo<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$sourcePath<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$parentPath&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$pathInfo<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'dirname'<\/span><span style=\"color: #007700\">];<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$dirName&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$pathInfo<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'basename'<\/span><span style=\"color: #007700\">];<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$z&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;new&nbsp;<\/span><span style=\"color: #0000BB\">ZipArchive<\/span><span style=\"color: #007700\">();<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$z<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">open<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$outZipPath<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">ZipArchive<\/span><span style=\"color: #007700\">::<\/span><span style=\"color: #0000BB\">CREATE<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$z<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">addEmptyDir<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$dirName<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(<\/span><span style=\"color: #0000BB\">$sourcePath&nbsp;<\/span><span style=\"color: #007700\">==&nbsp;<\/span><span style=\"color: #0000BB\">$dirName<\/span><span style=\"color: #007700\">){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">self<\/span><span style=\"color: #007700\">::<\/span><span style=\"color: #0000BB\">dirToZip<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$sourcePath<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$z<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">0<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}else{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">self<\/span><span style=\"color: #007700\">::<\/span><span style=\"color: #0000BB\">dirToZip<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$sourcePath<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$z<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">strlen<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">\"<\/span><span style=\"color: #0000BB\">$parentPath<\/span><span style=\"color: #DD0000\">\/\"<\/span><span style=\"color: #007700\">));<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$z<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">close<\/span><span style=\"color: #007700\">();<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;<\/span><span style=\"color: #0000BB\">true<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/**<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Add&nbsp;files&nbsp;and&nbsp;sub-directories&nbsp;in&nbsp;a&nbsp;folder&nbsp;to&nbsp;zip&nbsp;file.<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;$folder&nbsp;string<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Folder&nbsp;path&nbsp;that&nbsp;should&nbsp;be&nbsp;zipped.<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;$zipFile&nbsp;ZipArchive<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Zip&nbsp;file&nbsp;where&nbsp;files&nbsp;end&nbsp;up.<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;$exclusiveLength&nbsp;int&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Number&nbsp;of&nbsp;text&nbsp;to&nbsp;be&nbsp;excluded&nbsp;from&nbsp;the&nbsp;file&nbsp;path.&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">private&nbsp;static&nbsp;function&nbsp;<\/span><span style=\"color: #0000BB\">dirToZip<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$folder<\/span><span style=\"color: #007700\">,&nbsp;&amp;<\/span><span style=\"color: #0000BB\">$zipFile<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$exclusiveLength<\/span><span style=\"color: #007700\">){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$handle&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">opendir<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$folder<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while(<\/span><span style=\"color: #0000BB\">FALSE&nbsp;<\/span><span style=\"color: #007700\">!==&nbsp;<\/span><span style=\"color: #0000BB\">$f&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">readdir<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$handle<\/span><span style=\"color: #007700\">)){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Check&nbsp;for&nbsp;local\/parent&nbsp;path&nbsp;or&nbsp;zipping&nbsp;file&nbsp;itself&nbsp;and&nbsp;skip<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">if(<\/span><span style=\"color: #0000BB\">$f&nbsp;<\/span><span style=\"color: #007700\">!=&nbsp;<\/span><span style=\"color: #DD0000\">'.'&nbsp;<\/span><span style=\"color: #007700\">&amp;&amp;&nbsp;<\/span><span style=\"color: #0000BB\">$f&nbsp;<\/span><span style=\"color: #007700\">!=&nbsp;<\/span><span style=\"color: #DD0000\">'..'&nbsp;<\/span><span style=\"color: #007700\">&amp;&amp;&nbsp;<\/span><span style=\"color: #0000BB\">$f&nbsp;<\/span><span style=\"color: #007700\">!=&nbsp;<\/span><span style=\"color: #0000BB\">basename<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">__FILE__<\/span><span style=\"color: #007700\">)){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$filePath&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">\"<\/span><span style=\"color: #0000BB\">$folder<\/span><span style=\"color: #DD0000\">\/<\/span><span style=\"color: #0000BB\">$f<\/span><span style=\"color: #DD0000\">\"<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Remove&nbsp;prefix&nbsp;from&nbsp;file&nbsp;path&nbsp;before&nbsp;add&nbsp;to&nbsp;zip<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$localPath&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">substr<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$filePath<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$exclusiveLength<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(<\/span><span style=\"color: #0000BB\">is_file<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$filePath<\/span><span style=\"color: #007700\">)){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$zipFile<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">addFile<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$filePath<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$localPath<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}elseif(<\/span><span style=\"color: #0000BB\">is_dir<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$filePath<\/span><span style=\"color: #007700\">)){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Add&nbsp;sub-directory<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$zipFile<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">addEmptyDir<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$localPath<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">self<\/span><span style=\"color: #007700\">::<\/span><span style=\"color: #0000BB\">dirToZip<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$filePath<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$zipFile<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$exclusiveLength<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">closedir<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$handle<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>}<\/span><\/pre>\n<h2>Create ZIP File in PHP<\/h2>\n<p>Use ZipArchiver class to archive all files and sub-directories of the given folder and create ZIP file from the script in PHP.<\/p>\n<ul class=\"bullet_disk_list\">\n<li>Include and initialize the ZipArchive class.<\/li>\n<li>Specify the path of the directory which you want to archive as a ZIP.<\/li>\n<li>Specify the path to save the ZIP file on the server.<\/li>\n<li>Call the <code>zipDir()<\/code> function of ZipArchiver class to create ZIP.<\/li>\n<\/ul>\n<pre><span style=\"color: #FF8000\">\/\/&nbsp;Include&nbsp;and&nbsp;initialize&nbsp;ZipArchive&nbsp;class<br \/><\/span><span style=\"color: #007700\">require_once&nbsp;<\/span><span style=\"color: #DD0000\">'ZipArchiver.class.php'<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">$zipper&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;new&nbsp;<\/span><span style=\"color: #0000BB\">ZipArchiver<\/span><span style=\"color: #007700\">;<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Path&nbsp;of&nbsp;the&nbsp;directory&nbsp;to&nbsp;be&nbsp;zipped<br \/><\/span><span style=\"color: #0000BB\">$dirPath&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'\/path\/to\/sourceDir'<\/span><span style=\"color: #007700\">;<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Path&nbsp;of&nbsp;output&nbsp;zip&nbsp;file<br \/><\/span><span style=\"color: #0000BB\">$zipPath&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'\/path\/to\/archive-'<\/span><span style=\"color: #007700\">.<\/span><span style=\"color: #0000BB\">time<\/span><span style=\"color: #007700\">().<\/span><span style=\"color: #DD0000\">'.zip'<\/span><span style=\"color: #007700\">;<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Create&nbsp;zip&nbsp;archive<br \/><\/span><span style=\"color: #0000BB\">$zip&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$zipper<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">zipDir<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$dirPath<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$zipPath<\/span><span style=\"color: #007700\">);<br \/><br \/>if(<\/span><span style=\"color: #0000BB\">$zip<\/span><span style=\"color: #007700\">){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<\/span><span style=\"color: #DD0000\">'ZIP&nbsp;archive&nbsp;created&nbsp;successfully.'<\/span><span style=\"color: #007700\">;<br \/>}else{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<\/span><span style=\"color: #DD0000\">'Failed&nbsp;to&nbsp;create&nbsp;ZIP.'<\/span><span style=\"color: #007700\">;<br \/>}<\/span><\/pre>\n<p class=\"seeAlso\"><span><\/span><a href=\"https:\/\/www.codexworld.com\/extract-zip-gzip-rar-archive-file-using-php\/\">Extract ZIP File using PHP<\/a><\/span><\/p>\n<h2>Conclusion<\/h2>\n<p>This ZIP file creation script is very useful to generate an archive dynamically on the server using PHP. The dynamic ZIP creation functionality can be used for many purposes, downloading multiple files and folders from the server, reducing the usage of the server space, taking a backup of files and directories, etc. You can easily enhance the functionality of this code as per your needs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The ZIP is a commonly used file format to archive files with data compression. When you want to allow the user to download multiple folders and files at once from the server, you need to <\/p>\n","protected":false},"author":1,"featured_media":3469,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4],"tags":[345,14,319],"class_list":["post-3467","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-archive","tag-php","tag-zip","cat-4-id","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Create ZIP File using PHP - CodexWorld<\/title>\n<meta name=\"description\" content=\"Create ZIP archive in PHP - Example code to create ZIP from folder using PHP. Use ZipArchiver class to archive entire directory recursively and create a ZIP file using PHP.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codexworld.com\/create-zip-file-using-php\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create ZIP File using PHP - CodexWorld\" \/>\n<meta property=\"og:description\" content=\"Create ZIP archive in PHP - Example code to create ZIP from folder using PHP. Use ZipArchiver class to archive entire directory recursively and create a ZIP file using PHP.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codexworld.com\/create-zip-file-using-php\/\" \/>\n<meta property=\"og:site_name\" content=\"CodexWorld\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:published_time\" content=\"2018-09-06T18:25:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-16T15:09:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/09\/php-create-archive-zip-file-from-folder-recursively-codexworld.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1366\" \/>\n\t<meta property=\"og:image:height\" content=\"768\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CodexWorld\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codexworldblog\" \/>\n<meta name=\"twitter:site\" content=\"@codexworldweb\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CodexWorld\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-zip-file-using-php\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-zip-file-using-php\\\/\"},\"author\":{\"name\":\"CodexWorld\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\"},\"headline\":\"Create ZIP File using PHP\",\"datePublished\":\"2018-09-06T18:25:46+00:00\",\"dateModified\":\"2025-06-16T15:09:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-zip-file-using-php\\\/\"},\"wordCount\":431,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-zip-file-using-php\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/php-create-archive-zip-file-from-folder-recursively-codexworld.png\",\"keywords\":[\"Archive\",\"PHP\",\"ZIP\"],\"articleSection\":[\"PHP\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/create-zip-file-using-php\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-zip-file-using-php\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/create-zip-file-using-php\\\/\",\"name\":\"Create ZIP File using PHP - CodexWorld\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-zip-file-using-php\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-zip-file-using-php\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/php-create-archive-zip-file-from-folder-recursively-codexworld.png\",\"datePublished\":\"2018-09-06T18:25:46+00:00\",\"dateModified\":\"2025-06-16T15:09:11+00:00\",\"description\":\"Create ZIP archive in PHP - Example code to create ZIP from folder using PHP. Use ZipArchiver class to archive entire directory recursively and create a ZIP file using PHP.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-zip-file-using-php\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/create-zip-file-using-php\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-zip-file-using-php\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/php-create-archive-zip-file-from-folder-recursively-codexworld.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/php-create-archive-zip-file-from-folder-recursively-codexworld.png\",\"width\":1366,\"height\":768,\"caption\":\"php-create-archive-zip-file-from-folder-recursively-codexworld\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-zip-file-using-php\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codexworld.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create ZIP File using PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"name\":\"CodexWorld\",\"description\":\"Web &amp; Mobile App Development Company\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codexworld.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\",\"name\":\"CodexWorld\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"width\":200,\"height\":19,\"caption\":\"CodexWorld\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldweb\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/codexworld\",\"https:\\\/\\\/www.youtube.com\\\/codexworld\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\",\"name\":\"CodexWorld\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"caption\":\"CodexWorld\"},\"description\":\"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.\",\"sameAs\":[\"http:\\\/\\\/www.codexworld.com\",\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldblog\"],\"url\":\"https:\\\/\\\/www.codexworld.com\\\/author\\\/nitya192265\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create ZIP File using PHP - CodexWorld","description":"Create ZIP archive in PHP - Example code to create ZIP from folder using PHP. Use ZipArchiver class to archive entire directory recursively and create a ZIP file using PHP.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codexworld.com\/create-zip-file-using-php\/","og_locale":"en_US","og_type":"article","og_title":"Create ZIP File using PHP - CodexWorld","og_description":"Create ZIP archive in PHP - Example code to create ZIP from folder using PHP. Use ZipArchiver class to archive entire directory recursively and create a ZIP file using PHP.","og_url":"https:\/\/www.codexworld.com\/create-zip-file-using-php\/","og_site_name":"CodexWorld","article_publisher":"https:\/\/www.facebook.com\/codexworld","article_author":"https:\/\/www.facebook.com\/codexworld","article_published_time":"2018-09-06T18:25:46+00:00","article_modified_time":"2025-06-16T15:09:11+00:00","og_image":[{"width":1366,"height":768,"url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/09\/php-create-archive-zip-file-from-folder-recursively-codexworld.png","type":"image\/png"}],"author":"CodexWorld","twitter_card":"summary_large_image","twitter_creator":"@codexworldblog","twitter_site":"@codexworldweb","twitter_misc":{"Written by":"CodexWorld","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codexworld.com\/create-zip-file-using-php\/#article","isPartOf":{"@id":"https:\/\/www.codexworld.com\/create-zip-file-using-php\/"},"author":{"name":"CodexWorld","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0"},"headline":"Create ZIP File using PHP","datePublished":"2018-09-06T18:25:46+00:00","dateModified":"2025-06-16T15:09:11+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codexworld.com\/create-zip-file-using-php\/"},"wordCount":431,"commentCount":1,"publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"image":{"@id":"https:\/\/www.codexworld.com\/create-zip-file-using-php\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/09\/php-create-archive-zip-file-from-folder-recursively-codexworld.png","keywords":["Archive","PHP","ZIP"],"articleSection":["PHP"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codexworld.com\/create-zip-file-using-php\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codexworld.com\/create-zip-file-using-php\/","url":"https:\/\/www.codexworld.com\/create-zip-file-using-php\/","name":"Create ZIP File using PHP - CodexWorld","isPartOf":{"@id":"https:\/\/www.codexworld.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codexworld.com\/create-zip-file-using-php\/#primaryimage"},"image":{"@id":"https:\/\/www.codexworld.com\/create-zip-file-using-php\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/09\/php-create-archive-zip-file-from-folder-recursively-codexworld.png","datePublished":"2018-09-06T18:25:46+00:00","dateModified":"2025-06-16T15:09:11+00:00","description":"Create ZIP archive in PHP - Example code to create ZIP from folder using PHP. Use ZipArchiver class to archive entire directory recursively and create a ZIP file using PHP.","breadcrumb":{"@id":"https:\/\/www.codexworld.com\/create-zip-file-using-php\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codexworld.com\/create-zip-file-using-php\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/create-zip-file-using-php\/#primaryimage","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/09\/php-create-archive-zip-file-from-folder-recursively-codexworld.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/09\/php-create-archive-zip-file-from-folder-recursively-codexworld.png","width":1366,"height":768,"caption":"php-create-archive-zip-file-from-folder-recursively-codexworld"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codexworld.com\/create-zip-file-using-php\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codexworld.com\/"},{"@type":"ListItem","position":2,"name":"Create ZIP File using PHP"}]},{"@type":"WebSite","@id":"https:\/\/www.codexworld.com\/#website","url":"https:\/\/www.codexworld.com\/","name":"CodexWorld","description":"Web &amp; Mobile App Development Company","publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codexworld.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codexworld.com\/#organization","name":"CodexWorld","url":"https:\/\/www.codexworld.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","width":200,"height":19,"caption":"CodexWorld"},"image":{"@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldweb","https:\/\/www.linkedin.com\/company\/codexworld","https:\/\/www.youtube.com\/codexworld"]},{"@type":"Person","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0","name":"CodexWorld","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","caption":"CodexWorld"},"description":"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.","sameAs":["http:\/\/www.codexworld.com","https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldblog"],"url":"https:\/\/www.codexworld.com\/author\/nitya192265\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/09\/php-create-archive-zip-file-from-folder-recursively-codexworld.png","jetpack_shortlink":"https:\/\/wp.me\/p6bxIh-TV","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/3467","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/comments?post=3467"}],"version-history":[{"count":8,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/3467\/revisions"}],"predecessor-version":[{"id":5801,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/3467\/revisions\/5801"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media\/3469"}],"wp:attachment":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media?parent=3467"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/categories?post=3467"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/tags?post=3467"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}