0

I have installed phpword package in my laravel project. Now when I try to read a docx file using this code

public function upload(Request $request){
    $file = $request->file('file');
    $phpWord = \PhpOffice\PhpWord\IOFactory::load($file);
    foreach($phpWord->getSections() as $section) {
        foreach($section->getElements() as $element) {
            if(method_exists($element,'getText')) {
                echo $element->getText() . "<br>";
            }
        }
    }
}

I am getting an error

Class 'ZipArchive' not found

/vendor/phpoffice/common/src/Common/XMLReader.php line no 54

zip already installed in my php. enter image description here

Community
  • 1
  • 1
Md. Sahadat Hossain
  • 3,210
  • 4
  • 32
  • 55

1 Answers1

6

Please run command for cache clear and dump-autoload like php artisan config:cache and composer dump-autoload

AddWeb Solution Pvt Ltd
  • 21,025
  • 5
  • 26
  • 57