ZipArchiveEx class not found using laravel 4

945 Views Asked by At

I have laravel4 setup in local pc with php version 5.5.6. In Laravel setup i installed the 'codeless/ziparchiveex' module and installed fine but when i put ziparchive coding in my controllers it gives error message "ZipArchiveEx Class Not Found". I see phpinfo file and zip file extension already enable so please help me to solve this issue.

My Coding of controller file is :

$zip = new ZipArchiveEx();
                $zip->open('path-to-zip', ZIPARCHIVE::OVERWRITE);
                $zip->addDir('directory-path');
                $zip->addDirContents("Image path contents");
                $zip->close();
1

There are 1 best solutions below

2
On

Assuming you installed the package through composer, did you then registered the package in your app/cofig/app.php under the providers and facades arrays?

Otherwise try to require the class on the top of your controllers:

require('vendor/codeless/src/ZipArchiveEx.php'); //for the path here just use your installation path 

Also if you get a:

PHP Fatal error: Class 'ZipArchiveEx' not found in project/vendor/laravel/framework/src/Illuminate/something/ZipArchiveEx.php on line xyz

This should fix it - Go in terminal, navigate to your project's directory and run:

composer dump-auto