What are the potential reasons for the PHP Fatal error: Class 'ZipArchive' not found and how can it be resolved?

The PHP Fatal error "Class 'ZipArchive' not found" occurs when the Zip extension is not enabled in your PHP configuration. To resolve this issue, you need to enable the Zip extension in your php.ini file or install the Zip extension if it's not already installed on your server.

// Check if ZipArchive class exists
if (!class_exists('ZipArchive')) {
    die('ZipArchive class not found. Please enable the Zip extension in your PHP configuration.');
}

// Your code that uses the ZipArchive class