protected function unZip($name)
    {
        $zipFileName = basename($this->files[$name]['url']);
        if (!substr($zipFileName, -4) === '.zip')
            throw new RuntimeException($zipFileName . ' does not have .zip extension');

        // Final file path
        $storagePath = config('geonames.storagePath');
        $extractedFile = $this->files[$name]['filename'] . '.txt';
        $path = $storagePath . '/' . $extractedFile;

        // Open zip archive because we need the size of extracted file
        $zipArchive = new ZipArchive;
        $zipArchive->open($storagePath . '/' . $zipFileName);

        if (file_exists($path)) {
            $uncompressedSize = $zipArchive->statName($extractedFile)['size'];
            $fileSize = filesize($path);
            if ($uncompressedSize !== $fileSize) {
                $this->line('<info>Existing File:</info> ' . basename($path) . ' size does not match the one in ' . $zipFileName);
            } else {
                // Do not extract again
                $this->line('<info>Existing File:</info> ' . 'Found ' . basename($path) . ' file extracted from ' . $zipFileName);
                $zipArchive->close();
                return;
            }
        }
        // File does not exist or size does not match
        $this->line('<info>Extracting File:</info> ' . $extractedFile . ' from ' . $zipFileName . ' ...!!!Please Wait!!!...');
        // Extract file
        $zipArchive->extractTo($storagePath . '/', $extractedFile);
        $zipArchive->close();
    }
protected function unZip($name)
    {
        $zipFileName = basename($this->files[$name]['url']);
        if (!substr($zipFileName, -4) === '.zip')
            throw new RuntimeException($zipFileName . ' does not have .zip extension');

        // Final file path
        $storagePath = config('geonames.storagePath');
        $extractedFile = $this->files[$name]['filename'] . '.txt';
        $path = $storagePath . '/' . $extractedFile;

        // Open zip archive because we need the size of extracted file
        $zipArchive = new ZipArchive;
        $zipArchive->open($storagePath . '/' . $zipFileName);

        if (file_exists($path)) {
            $uncompressedSize = $zipArchive->statName($extractedFile)['size'];
            $fileSize = filesize($path);
            if ($uncompressedSize !== $fileSize) {
                $this->line('<info>Existing File:</info> ' . basename($path) . ' size does not match the one in ' . $zipFileName);
            } else {
                // Do not extract again
                $this->line('<info>Existing File:</info> ' . 'Found ' . basename($path) . ' file extracted from ' . $zipFileName);
                $zipArchive->close();
                return;
            }
        }
        // File does not exist or size does not match
        $this->line('<info>Extracting File:</info> ' . $extractedFile . ' from ' . $zipFileName . ' ...!!!Please Wait!!!...');
        // Extract file
        $zipArchive->extractTo($storagePath . '/', $extractedFile);
        $zipArchive->close();
    }
protected function unZip ( $ name ) { $ zipFileName = basename ( $ this -> files [ $ name ] [ 'url' ] ) ; if ( ! substr ( $ zipFileName , - 4 ) === '.zip' ) throw new RuntimeException ( $ zipFileName . ' does not have .zip extension' ) ; // Final file path
 $ storagePath = config ( 'geonames.storagePath' ) ; $ extractedFile = $ this -> files [ $ name ] [ 'filename' ] . '.txt' ; $ path = $ storagePath . '/' . $ extractedFile ; // Open zip archive because we need the size of extracted file
 $ zipArchive = new ZipArchive ; $ zipArchive -> open ( $ storagePath . '/' . $ zipFileName ) ; if ( file_exists ( $ path ) ) { $ uncompressedSize = $ zipArchive -> statName ( $ extractedFile ) [ 'size' ] ; $ fileSize = filesize ( $ path ) ; if ( $ uncompressedSize !== $ fileSize ) { $ this -> line ( '<info>Existing File:</info> ' . basename ( $ path ) . ' size does not match the one in ' . $ zipFileName ) ; } else { // Do not extract again
 $ this -> line ( '<info>Existing File:</info> ' . 'Found ' . basename ( $ path ) . ' file extracted from ' . $ zipFileName ) ; $ zipArchive -> close ( ) ; return ; } } // File does not exist or size does not match
 $ this -> line ( '<info>Extracting File:</info> ' . $ extractedFile . ' from ' . $ zipFileName . ' ...!!!Please Wait!!!...' ) ; // Extract file
 $ zipArchive -> extractTo ( $ storagePath . '/' , $ extractedFile ) ; $ zipArchive -> close ( ) ; }
Unzip the file

@param  string $name
Unzip the file