$zip = new ZipArchive; $zip->open('archive.zip', ZipArchive::CREATE); // Add all PDF files in files directory to the archive $zip->addGlob('files/*.pdf'); $zip->close();Example 2: Suppose you have a directory name `assets` containing different sub-directories and you want to add all `.css` and `.js` files inside root directory and its sub-directories to a ZIP archive. the syntax will be like: ```php $zip = new ZipArchive; $zip->open('app_assets.zip', ZipArchive::CREATE); // Add all css files from root level assets directory and its subdirectories $zip->addGlob('assets/*.css', 0, ['add_path' => '/']); // Add all js files from root level assets directory and its subdirectories $zip->addGlob('assets/*.js', 0, ['add_path' => '/']); $zip->close(); ``` Package library is `php-zip` and it's a part of the PHP Core.