适用于Laravel的AWS SDK给出了致命错误

I installed the https://github.com/aws/aws-sdk-php-laravel‎ SDK and followed the instructions in the readme.md. Everything installed, I put in my key, secret, region, etc. in the /app/config/packages/aws/aws-sdk-php-laravel.

The Error I'm Getting

PHP Fatal error:  Class 'Aws\Common\Aws' not found in /Volumes/Data/Users/chris/Sites/ln.com/vendor/aws/aws-sdk-php-laravel/src/Aws/Laravel/AwsServiceProvider.php on line 48
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'Aws\\Common\\Aws' not found","file":"\/Volumes\/Data\/Users\/chris\/Sites\/ln.com\/vendor\/aws\/aws-sdk-php-laravel\/src\/Aws\/Laravel\/AwsServiceProvider.php","line":48}}

Line 48 of that file referenced above simply says:

$aws = Aws::factory($config);

I installed per the instructions

I put in my providers and aliases in /app/config/app.php with:

'Aws\Laravel\AwsServiceProvider'

in the providers array.

I put in:

'AWS' => 'Aws\Laravel\AwsFacade'

in the aliases section.

Then, I'm trying to use their same usage example:

    $s3 = AWS::get('s3');
$s3->putObject(array(
    'Bucket'    => 'My Bucket',
    'Key'       => 'My Key',
    'SourceFile'=> Config::get('settings.ProcessListings.image_dir') . $listing->mls_listing_id . "/test.txt"
                ));

What I've Tried

My only thoughts here were that in my file that I'm trying to use the SDK in, at the top I have:

    use Illuminate\Console\Command;
    use Symfony\Component\Console\Input\InputOption;
    use Symfony\Component\Console\Input\InputArgument;

I've added to that:

use Aws\Laravel\AwsFacade;
use Aws\Laravel\AwsServiceProvider;

and combinations of the two but neither work. Any ideas?

Your problem is in a class Aws\Common\Aws from aws/aws-sdk-php which is not available to composer (the autoloader). Those are steps that usually fix Laravel, when things like this happen and the problem is not on your source code, of course:

cd /your/application/dir

rm bootstrap/compiled.php

rm -rf vendor (or just rename your vendor folder to test)

composer update --no-dev

I know I am late but, I've come across this problem recently and I didn't want to remove my compiled packages. In my case, running php artisan config:cache was throwing that error. So what I did, I found Aws\\Laravel\\AwsServiceProvider in bootstrap/cache/services.php and removed them which solved the issue.