Saturday, January 29, 2022

[FIXED] Class 'ZendService\Amazon\S3' not found even though it is installed via Composer

Issue

My project is based on the Zend Skeleton App, and I'm using Composer to add vendor packages. However, when I add the zendservice-amazon package, it is not getting autoloaded.

Here is part of my composer.json file:

"require": {
    "php": ">=5.3.3",
    "zendframework/zendframework": "2.3.*",
    "zendframework/zendservice-amazon": "2.0.*",
    "doctrine/doctrine-orm-module": "0.7.*",
    "zf-commons/zfc-user-doctrine-orm": "dev-master"
}

I have looked at the autoload files in the vendor directory, and they include the ZendService\Amazon namespace. I've tried several different things, but it's not working.

I've double checked that composer's autoloader is being used, so this is really puzzling. Any ideas? Thanks in advance.


Solution

The documentation and examples are wrong in the Zend Framework documentation. Instead of:

$s3 = new \ZendService\Amazon\S3();

You need to add an extra "S3":

$s3 = new \ZendService\Amazon\S3\S3();


Answered By - Poldon

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.