public static function unZip($zip_file, $destination)
    {
        $zip = new \ZipArchive();
        $archive = $zip->open($zip_file);

        if ($archive === true) {
            Folder::create($destination);

            $unzip = $zip->extractTo($destination);


            if (!$unzip) {
                self::$error = self::ZIP_EXTRACT_ERROR;
                Folder::delete($destination);
                $zip->close();
                return false;
            }

            $package_folder_name = preg_replace('#\./$#', '', $zip->getNameIndex(0));
            $zip->close();

            return $destination . '/' . $package_folder_name;
        }

        self::$error = self::ZIP_EXTRACT_ERROR;
        self::$error_zip = $archive;
        return false;
    }
public static function unZip($zip_file, $destination)
    {
        $zip = new \ZipArchive();
        $archive = $zip->open($zip_file);

        if ($archive === true) {
            Folder::create($destination);

            $unzip = $zip->extractTo($destination);


            if (!$unzip) {
                self::$error = self::ZIP_EXTRACT_ERROR;
                Folder::delete($destination);
                $zip->close();
                return false;
            }

            $package_folder_name = preg_replace('#\./$#', '', $zip->getNameIndex(0));
            $zip->close();

            return $destination . '/' . $package_folder_name;
        }

        self::$error = self::ZIP_EXTRACT_ERROR;
        self::$error_zip = $archive;
        return false;
    }
public static function unZip ( $ zip_file , $ destination ) { $ zip = new \ ZipArchive ( ) ; $ archive = $ zip -> open ( $ zip_file ) ; if ( $ archive === true ) { Folder :: create ( $ destination ) ; $ unzip = $ zip -> extractTo ( $ destination ) ; if ( ! $ unzip ) { self :: $ error = self :: ZIP_EXTRACT_ERROR ; Folder :: delete ( $ destination ) ; $ zip -> close ( ) ; return false ; } $ package_folder_name = preg_replace ( '#\./$#' , '' , $ zip -> getNameIndex ( 0 ) ) ; $ zip -> close ( ) ; return $ destination . '/' . $ package_folder_name ; } self :: $ error = self :: ZIP_EXTRACT_ERROR ; self :: $ error_zip = $ archive ; return false ; }
Unzip a file to somewhere

@param string $zip_file
@param string $destination
@return bool|string
Unzip a file to somewhere