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
Please run command for cache clear and dump-autoload like php artisan config:cache
and composer dump-autoload