2

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?

7
  • 1
    Did you executed composer dump-autoload -o in your server? Commented Feb 14, 2014 at 17:08
  • Yes, same error even after the composer dump-autoload -o Commented Feb 14, 2014 at 17:13
  • 1
    Also did composer update? Because Aws\Common\Aws is part of aws/aws-sdk-php and it looks like it is not installed. Commented Feb 14, 2014 at 17:35
  • Interesting but running codecomposer updatecode returned an all new error: Commented Feb 14, 2014 at 17:42
  • 1
    Which error you're getting now? Commented Feb 14, 2014 at 17:44

2 Answers 2

6

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
Sign up to request clarification or add additional context in comments.

1 Comment

This will remove the ´/vendor/autoload.php´ which is not a good idea.
2

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.