When I initialize S3 bucket in laravel, I am getting the following error
Call to undefined method Aws\Common\Aws::createClient()
I use
{
"require": {
"aws/aws-sdk-php-laravel": "~3.0"
}
}
Here is the function
public function uploadProductImgAPI(Request $request)
{
$file = $request->file('file');
$extension = $file->getClientOriginalExtension();
$s3 = AWS::createClient('s3');
dd($s3);
return response()->json('upload ok!!');
}
Thanks!!
The doc mentions
If the AWS facade is registered within the
aliases
section of the application configuration, you can also use the following technique.$s3 = AWS::createClient('s3');
else you can use the following
$s3 = App::make('aws')->createClient('s3');