简体   繁体   中英

Aws-sdk-php-laravel get 500 error in laravel 5.2

I follow aws-sdk-php-laravel readme.md to setup aws-sdk-php-laravel in laravel 5.2

In composer.json

"require": {
    "php": ">=5.5.9",
    "laravel/framework": "5.2.*",
    "aws/aws-sdk-php-laravel": "3.1.0"
},

composer update

In config/app.php

providers add

Aws\Laravel\AwsServiceProvider::class,

aliases add

'Aws' => Aws\Laravel\AwsFacade::class,

php artisan vendor:publish

and one of controllers

<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Aws;

$cloudSearchDomain = App::make('aws')->get('cloudsearchdomain', array('endpoint' => xxxxxxxxxxxxxxxxxxxxxxxxxxx));

always get

Fatal error: Class 'App\App' not found

If add

use App;

get

BadMethodCallException in Sdk.php line 178:
Unknown method: get.

but the same code work fine in laravel 4.2

How can I fix it?

$cloudSearchDomain = App::make('aws')->createClient('cloudsearchdomain', [
    'endpoint' => xxxxxxxxxxxxxxxxxxxxxxxxxxx,
]);

or

$cloudSearchDomain = Aws::createClient('cloudsearchdomain', [
    'endpoint' => xxxxxxxxxxxxxxxxxxxxxxxxxxx,
]);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM