Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Composer Flysystem Zip class not working.

In the PHP Standards and Best Practices course, the Composer video covers code to examine a .zip file:

use League\Flysystem\Filesystem; use League\Flysystem\Adaptor\Zip as Adapter;

Though, I keep receiving the following:

Fatal error: Class 'League\Flysystem\Adaptor\Zip' not found in /home/treehouse/workspace/index.php on line 10

Composer has downloaded Flysystem version: ^1.0 as opposed to the v:0.5.6 as used in the video. I tried updating the Flysystem version to that used in the video to no avail so reverted back to 1.0.

I found a solution to swap out the \Adaptor\Zip for \ZipArchive\ZipArchiveAdaptor as in the following which proved to be successful and allow the code to run without error:

http://flysystem.thephpleague.com/adapter/zip-archive/

Just to reiterate, the above ZipArchive substitution allowed to code to run though, my question is around what was wrong with the \ZipArchive\Zip requirement and whether there could be something wrong with the version vs availability if \Zip or whether that has to be required via Composer separately after Flysystem is installed or whether there could be something else preventing it from working?

This question's purpose is also to assist anyone who may be having trouble with the use of \Zip and to keep them moving forward throughout their course.

Thanks for any help and info.