Code Monkey home page Code Monkey logo

aws-sdk-php-laravel's Introduction

AWS Service Provider for Laravel 5 - 11

Latest Stable Version Total Downloads Gitter

This is a simple Laravel service provider for making it easy to include the official AWS SDK for PHP in your Laravel and Lumen applications.

This README is for version 3.x of the service provider, which is implemented to work with Version 3 of the AWS SDK for PHP and Laravel 5.1.

Major Versions:

  • 3.x (YOU ARE HERE) - For laravel/framework:6.0|7.0|8.0|9.0|10.0|11.0 and aws/aws-sdk-php:^3.279.0
  • 2.x (2.0 branch) - For laravel/framework:5.0.* and aws/aws-sdk-php:~2.4
  • 1.x (1.0 branch) - For laravel/framework:4.* and aws/aws-sdk-php:~2.4

Jump To:

Getting Started

Installation

The AWS Service Provider can be installed via Composer by requiring the aws/aws-sdk-php-laravel package in your project's composer.json.

{
    "require": {
        "aws/aws-sdk-php-laravel": "~3.0"
    }
}

Then run a composer update

php composer.phar update

To use the AWS Service Provider, you must register the provider when bootstrapping your application.

Lumen

In Lumen find the Register Service Providers in your bootstrap/app.php and register the AWS Service Provider.

    $app->register(Aws\Laravel\AwsServiceProvider::class);

Laravel

In Laravel find the providers key in your config/app.php and register the AWS Service Provider.

    'providers' => array(
        // ...
        Aws\Laravel\AwsServiceProvider::class,
    )

Find the aliases key in your config/app.php and add the AWS facade alias.

    'aliases' => array(
        // ...
        'AWS' => Aws\Laravel\AwsFacade::class,
    )

Configuration

By default, the package uses the following environment variables to auto-configure the plugin without modification:

AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_REGION (default = us-east-1)

To customize the configuration file, publish the package configuration using Artisan.

php artisan vendor:publish  --provider="Aws\Laravel\AwsServiceProvider"

The settings can be found in the generated config/aws.php configuration file. By default, the credentials and region settings will pull from your .env file.

return [
    'credentials' => [
        'key'    => env('AWS_ACCESS_KEY_ID', ''),
        'secret' => env('AWS_SECRET_ACCESS_KEY', ''),
    ],
    'region' => env('AWS_REGION', 'us-east-1'),
    'version' => 'latest',
    // You can override settings for specific services
    'Ses' => [
        'region' => 'us-east-1',
    ],
];

Note that you can always delete the credentials line from this file if you'd like to use the default SDK Configuration Provider chain instead.

Referring Laravel 5.2.0 Upgrade guide, you must using config file instead of environment variable option if using php artisan config:cache.

Learn more about configuring the SDK on the SDK's User Guide.

Usage

In order to use the AWS SDK for PHP within your app, you need to retrieve it from the Laravel Service Container. The following example uses the Amazon S3 client to upload a file.

$s3 = App::make('aws')->createClient('s3');
$s3->putObject(array(
    'Bucket'     => 'YOUR_BUCKET',
    'Key'        => 'YOUR_OBJECT_KEY',
    'SourceFile' => '/the/path/to/the/file/you/are/uploading.ext',
));

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');
$s3->putObject(array(
    'Bucket'     => 'YOUR_BUCKET',
    'Key'        => 'YOUR_OBJECT_KEY',
    'SourceFile' => '/the/path/to/the/file/you/are/uploading.ext',
));

To use in Lumen, you need to retrieve it from the service container a bit differently:

$s3 = app('aws')->createClient('s3');
$s3->putObject(array(
    'Bucket'     => 'YOUR_BUCKET',
    'Key'        => 'YOUR_OBJECT_KEY',
    'SourceFile' => '/the/path/to/the/file/you/are/uploading.ext',
));

Getting Help

Please use these community resources for getting help. We use the GitHub issues for tracking bugs and feature requests and have limited bandwidth to address them.

This SDK implements AWS service APIs. For general issues regarding the AWS services and their limitations, you may also take a look at the Amazon Web Services Discussion Forums.

Opening Issues

If you encounter a bug with aws-sdk-php-laravel we would like to hear about it. Search the existing issues and try to make sure your problem doesn’t already exist before opening a new issue. It’s helpful if you include the version of aws-sdk-php-laravel, PHP version and OS you’re using. Please include a stack trace and reduced repro case when appropriate, too.

The GitHub issues are intended for bug reports and feature requests. For help and questions with using aws-sdk-php please make use of the resources listed in the Getting Help section. There are limited resources available for handling issues and by keeping the list of open issues lean we can respond in a timely manner.

Contributing

We work hard to provide a high-quality and useful SDK for our AWS services, and we greatly value feedback and contributions from our community. Please review our contributing guidelines before submitting any issues or pull requests to ensure we have all the necessary information to effectively respond to your bug report or contribution.

Resources

aws-sdk-php-laravel's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-sdk-php-laravel's Issues

Download a file - AccessDeniedException 403 Forbidden

With both approaches I get:
Aws \ S3 \ Exception \ AccessDeniedException
403 Forbidden

$downloadUrl = \AWS::get('s3')->getObjectUrl(
    'bucket-tmp', 
    'report.pdf', 
    '+5 minutes', 
    ['ResponseContentDisposition' => 'attachment; filename="report.pdf"',]
);
$objInfo = \AWS::get('s3')->getObjectHeaders(['Bucket'=>'bucket-tmp', 'Key'=>'report.pdf']);
$obj = \AWS::get('s3')->getObject(['Bucket'=>'bucket-tmp', 'Key'=>'report.pdf']);
header('Content-type: ' . $objInfo->header['_info']['content_type']);
echo $obj->body;

Argument 1 passed to Illuminate\Config\FileLoader::mergeEnvironment() must be of the type array

Hello,

I have been using this package for a couple weeks with no problems. After doing a composer update recently, it seems like something got tweaked. It may be on my end but I am not sure. I am following the setup instructions exactly as they are listed in the readme.

This is the error:

Argument 1 passed to Illuminate\Config\FileLoader::mergeEnvironment() must be of the type array, integer given, called in ...vendor/laravel/framework/src/Illuminate/Config/FileLoader.php on line 87

which appears only when I try to instantiate the class using

$s3 = App::make('aws')->get('s3');

From what I can gather the problem is related to loading the configuration details, somehow.

Am I missing something? It seems odd that it would have been working before and not now.

Thanks,
~Ryan

us-west-2 does not map correctly

(Laravel 5.1, aws version 3.0)
My bucket is hosted on us-west-2, but when I specify us-west-2 in the config, the calls to the API fail. Changing the config to us-east-1 seems to fix the problem (even though my bucket is hosted on us-west-2)

FYI: composer update setup warning - Guzzle

During installation of 2.0 this warning shows up.

guzzle/guzzle suggests installing guzzlehttp/guzzle (Guzzle 5 has moved to a new package name. 
The package you have installed, Guzzle 3, is deprecated.)

Get exception about region not set when trying to create Elastic Transcoder client

I’m trying to instantiate an instance of the Elastic Transcoder client. This is my code:

$client = App::make('aws')->get('ElasticTranscoder');

However, when I use this I get the following exception:

A region is required when using Amazon Elastic Transcoder. Set "region" to one of: us-east-1, us-west-1, us-west-2, eu-west-1, ap-northeast-1, ap-southeast-1

How do I pass through configuration options (such as region) when creating an Elastic Transcoder client?

The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint: "s3.amazonaws.com".

This is my code:

$s3 = App::make('aws')->get('s3');
$s3->putObject(array(
    'Bucket'     => 'actual bucket name here',
    'Key'        => 'random key',
    'Body'   => fopen('file path here','r'),
));

If I set an end point like this:

$s3 = App::make('aws')->get('s3');
$s3->setEndpoint('s3-eu-west-1.amazonaws.com');
$s3->putObject(array(
   'Bucket'     => 'actual bucket name here',
   'Key'        => 'random key',
   'Body'   => fopen('/home/rahul/public_html/instrumental.mp3','r'),
));

I get the following error:
Argument 2 passed to Guzzle\Service\Client::getCommand() must be an array, string given, called in /home/rahul/public_html/qikview/vendor/guzzle/guzzle/src/Guzzle/Service/Client.php on line 76 and defined

I've tried replacing body with SourceFile too and it doesn't help. Any solution?

SES Email Format <end>

I just ran a quick test using this SDK to send an email using SES. All looks good it was properly sent and received however I noticed some weird <end> string appended to the end of my message in preview mode
(at least when using Microsoft Outlook)

email

        $successStatus = AWS::get('ses')->sendEmail(
            [
                'Source'           => self::formatHeader($fromName, $fromEmail),
                'Destination'      => ['ToAddresses' => $destinationEmails],
                'Message'          => [
                    'Subject' => ['Data' => $emailSubject],
                    'Body'    => ['Text' => ['Data' => $emailBody], 'Html' => ['Data' => $emailBody]],
                ],
                'ReplyToAddresses' => [$fromEmail]
            ]
        );

It this something the email browser is adding or is my message somehow corrupt or malformed?

Compatibility with Lumen

The AwsServiceProvider currently doesn't work in a Lumen project, because the config_path helper function isn't available.

Would it be reasonable to change line 9 ($this->publishes...) to first check to see if config_helper has been defined?

From what I can tell $this->publishes... doesn't need to be run in a Lumen app anyway, and I can still configure Aws using my .env file.

I'd be happy to submit a PR, just wanted to see if this was the right approach.

Class not found

I get this error

Class 'App\Http\Controllers\App' not found when trying to follow the example to the letter in Laravel 5.

any idea ?

Multiple Region Queries?

The config file generated by the SDK currently supports only one region. But for doing multi-region queries, this approach doesn't work. As a workaround, I can leave the region empty in config, but dynamically set it using Config::set.

get('ec2'); $instances = $ec2->describeInstances()->get('Reservations'); } ``` ?>

However, the provider is only registered once. Thus calling App::make 2nd time re-uses the config provided in the first call. With the standard AWS PHP SDK, we can call the factory multiple times, but doing so here would beat the purpose of IoC.

Is anyone else running into such issues? Thoughts?

Unable to set metadata

Hi - I'm using this but I need to be able to set metadata and am unable to work out the correct way to do this with this package:

I have tried

$s3->putObject(array(
        'Bucket'     => 'My-bucket',
        'Key'        => $filename,
        'SourceFile' => 'uploads/files/'. $filename,
        'ACL'        => 'public-read',
        'CacheControl' => 'max-age = 172800',
       'Expires' => $currentDate->format('D, d M Y H:i:s \G\M\T')
       )
    );

But cant get this to work. I want to be able to set cache control and expires data to enable caching iof assets

Thanks

Config Refactoring

The way configuration is provided to the service provider needs to be updated. This issue and an accompanying PR that I'm working on will be used to replace #15, #8, and #7. Thanks to @AndreasHeiberg, @iricketson, @trackops, and @rtablada for their contributions towards this issue already. I should have a PR soon for you to check out.

Nginx timeout when trying to push to s3

Hi, I am getting a timeout from my server, laravel log shows

[2015-08-26 09:06:08] local.ERROR: exception 'Aws\S3\Exception\S3Exception' with message 'Error executing "PutObject" on "https://s3-eu-west-1.amazonaws.com/topcat-pic1/151821305_161330756575186_1440575915_s.png"; AWS HTTP error: cURL error 7: Failed to connect to s3-eu-west-1.amazonaws.com port 443: Connection timed out (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)'

exception 'GuzzleHttp\Exception\ConnectException' with message 'cURL error 7: Failed to connect to s3-eu-west-1.amazonaws.com port 443: Connection timed out (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)' in /home/vagrant/Code/project/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:168

config/aws.php

use Aws\Laravel\AwsServiceProvider;

return [
'credentials' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
],
'region' => env('AWS_REGION', 'us-east-1'),
'version' => 'latest',
'ua_append' => [
'L5MOD/' . AwsServiceProvider::VERSION,
],
];

.env

AWS_ACCESS_KEY_ID=MY_ACCESS_KEY
AWS_SECRET_ACCESS_KEY=MY_SECRET
AWS_REGION=eu-west-1

Public function update_profile_image() {
    $image = \Input::file('profile_image');

    $validation =  ImageService::ProfileImageValidate(\Input::all());

      if($validation->fails()) 
    {
       return $validation->errors();
    } 
    else {
        //temp path for the uploaded image
        $temp_path = storage_path('assets/images/temp');

        //rename the file
        $key = \rand() .'_'. ImageService::mt_rand_str(15). '_'. time(). '_s';

        $filename =  $key . '.' .\strtolower($image->getClientOriginalExtension()); //rename the file
        // store file temperorly 
        $temp_storage = $image->move($temp_path, $filename);

            $width = '720';
            $height = '720';

            $resize = \Image::resize(
                $filename, $width, $height, $temp_storage
            );

            try {
                $s3 = \AWS::createClient('S3');
                $s3->putObject(array(
                    'Bucket'            => 'topcat-pic1',
                    'Key'           => $key, //the image name
                    'SourceFile'        => $temp_path.'/'.$filename,  //file source
                    'ACL'           => 'public-read',
                    'StorageClass'      => 'REDUCED_REDUNDANCY'
                ));
            } catch (\AWS\Exception\S3Exception $e) {
                                   //echo the exception for now
                echo "There was an error uploading the file.\n";
            }
        }

Bind alias in ServiceProvider

It would be more convenient if the class alias is binded "behind the scenes" and you don't have to take care of the alias in your config/app.php

Service provider not deferred

The package method (called in boot) does a lot of file/directory checks when it is called. If you have an app that does a lot of things NOT related to AWS this will cause a problem. Would it be possible to set the service provider to be deferred?

Provide better usage instructions.

For most users of Laravel 4 they're used to simply registering the service provider in app/config/app.php. Your usage example is fine for registering the provider and passing in the config at runtime. I think a section explaining that creating an app/config/aws.php config file and simply adding the service provider to the array in app/config/app.php will yield the same result.

That's a more real usage for the majority of users.

Making files public?

EDIT: Turns out it works. There was an issue in my code which was causing the error apparently*

Looking at the sdk documentation I try to add an ACL as "public-read". Example put object:

$s3->putObject(array(
    'Bucket'     => 'bucket name',
    'Key'        => $destinationPath."/".$filename,
    'SourceFile'   => $file->getRealPath(),
    'ACL'         => 'public-read',
));

I get an error:
You must specify a non-null value for the Body or SourceFile parameters

This doesn't happen if the ACL line isn't present and the file is uploaded successfully. Anyway to get around this issue?

Simply Retrieving Information

I just wanted to retrieve some product informations with a product ID but it seems that I need to create one of those buckets. Therefore I would have to give credit card credentials.

Is that process really neccessary if one just wants to retrieve some informations?

Unable to upload file

This is my code

 $s3 = AWS::get('s3');
        $s3->putObject(array(
            'Bucket'     => bucket_name',
            'Key'        => 'random_key_name',
            'SourceFile' => 'file_name'
        ));

but I'm getting the following error:

[curl] 56: Problem (2) in the Chunked-Encoded data [url] https://s3-us-west-2.amazonaws.com/bucket_name/random_key_name

The server (us-west-2) is the correct server.

I read some other posts, and tried some other things like the code below - but I get same error:

$s3 = AWS::get('s3');
        $s3->setRegion('us-west-2');
        $s3->putObject(array(
            'Bucket'     => bucket_name',
            'Key'        => 'random_key_name',
            'ContentLength' => filesize('file_name'),
            'Body'   => fopen( file_name, 'r' ),
        ));

Any ideas?

How do I specify a custom endpoint using a configuration file?

Hi there,

I'm trying to configure the package to use a custom PHP config file so that I can use a custom endpoint. I can't get the application to use the custom config, I just get a 'Unable to open my/path/to/aws/config.php for reading" error.

I want to use one of the SSLv3 disabled endpoints so that I can test out whether the disabling of support will have an effect on our application. Currently we specify a region, our key and a secret to utilise the SDK. I want to use a config file to set an endpoint as per: http://docs.aws.amazon.com/aws-sdk-php/guide/latest/configuration.html#custom-endpoint

It sounds like I'm maybe specifying the path wrong, but I've tried all the possibilities I could think of and I can't find any documentation on what format it expects, how to use a custom endpoint using this package or if it is even possible at all.

Can you provide any help?

Thanks,

Sebastian

Problem uploading file with Input::file()

It might be an obvious one but I am a newcomer to S3 and I really can't figure this one out. I am trying to pass an uploaded file from my controller to S3 with this code.

$s3 = App::make('aws')->get('s3');
  $s3->putObject(array(
    'Bucket'       => '<my-bucket>', // I did change that to a real bucket name
    'Key'           => Input::file('fieldname')->getClientOriginalName(),
    'SourceFile' => Input::file('fieldname')->getRealPath(),
));

It seems to me like it's the right way but nothing happens. I ran the package's tests and they all passed. I tried to run a var_dump() on the $s3->putObject(...) which returns me a object(Guzzle\Service\Resource\Model) but all its values are Null. Is there something I didn't get?

Security Credential issue.

Trying to just upload files. It feels like my key and secret arent working but i've double checked they are the right ones. Codes copied straight out of the readme.

Error:

Error retrieving credentials from the instance profile metadata server. 
When you are not running inside of Amazon EC2, you must provide your AWS
access key ID and secret access key in the "key" and "secret" options when 
creating a client or provide an instantiated
Aws\Common\Credentials\CredentialsInterface object.
([curl] 7: Failed to connect to 169.254.169.254: Host is down [url] 
http://169.254.169.254/latest/meta-data/iam/security-credentials/)

Function:

$s3 = AWS::get('s3');
$s3->putObject(array(
    'Bucket'        => '[bucketname]',
    'Key'           => '[key]',
    'SourceFile'    => '[file]'
)); 

AWS Facade not working

Hi when ever I try to use AWS::get('s3') is get this error Non-static method Guzzle\Service\Builder\ServiceBuilder::get() should not be called statically, assuming $this from incompatible context.
I can use App::make('aws')->get('s3') but I can not use the shorter method.

api is a required option

I am using the default Laravel SQS queue driver, when I try to push a job onto the queue I am getting the following error:

InvalidArgumentException in AwsClient.php line 77:
api is a required option

My code for pushing onto the class is a simple Laravel 5.1 job

class FooBarClass extends Job implements SelfHandling {  }

I am using version ~3.0 of this package and before updating to Laravel 5.1 this was working, I have updated the aws.php config file for the new version as well.

Composer Update not working

I'm getting this error when running a composer update:

Problem 1
- aws/aws-sdk-php-laravel 1.0.4 requires aws/aws-sdk-php ~2.2 -> satisfiable by aws/aws-sdk-php[2.2.0, 2.2.1, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0, 2.4.1, 2.4.10, 2.4.11, 2.4.12, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8, 2.4.9, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.6.0, 2.6.1, 2.6.10, 2.6.11, 2.6.12, 2.6.13, 2.6.14, 2.6.15, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.6.6, 2.6.7, 2.6.8, 2.6.9].
- aws/aws-sdk-php-laravel 1.1.0 requires aws/aws-sdk-php ~2.2 -> satisfiable by aws/aws-sdk-php[2.2.0, 2.2.1, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0, 2.4.1, 2.4.10, 2.4.11, 2.4.12, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8, 2.4.9, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.6.0, 2.6.1, 2.6.10, 2.6.11, 2.6.12, 2.6.13, 2.6.14, 2.6.15, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.6.6, 2.6.7, 2.6.8, 2.6.9].
- aws/aws-sdk-php-laravel 1.1.1 requires aws/aws-sdk-php ~2.2 -> satisfiable by aws/aws-sdk-php[2.2.0, 2.2.1, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0, 2.4.1, 2.4.10, 2.4.11, 2.4.12, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8, 2.4.9, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.6.0, 2.6.1, 2.6.10, 2.6.11, 2.6.12, 2.6.13, 2.6.14, 2.6.15, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.6.6, 2.6.7, 2.6.8, 2.6.9].
- aws/aws-sdk-php-laravel 1.0.3 requires aws/aws-sdk-php ~2.1 -> satisfiable by aws/aws-sdk-php[2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.2.1, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0, 2.4.1, 2.4.10, 2.4.11, 2.4.12, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8, 2.4.9, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.6.0, 2.6.1, 2.6.10, 2.6.11, 2.6.12, 2.6.13, 2.6.14, 2.6.15, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.6.6, 2.6.7, 2.6.8, 2.6.9].
- aws/aws-sdk-php 2.4.0 requires guzzle/guzzle ~3.7.0 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4].
- aws/aws-sdk-php 2.4.1 requires guzzle/guzzle ~3.7.0 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4].
- aws/aws-sdk-php 2.4.10 requires guzzle/guzzle ~3.7.0 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4].
- aws/aws-sdk-php 2.4.11 requires guzzle/guzzle ~3.7.0 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4].
- aws/aws-sdk-php 2.4.12 requires guzzle/guzzle >=3.7.0,<3.9.0 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1].
- aws/aws-sdk-php 2.4.2 requires guzzle/guzzle ~3.7.0 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4].
- aws/aws-sdk-php 2.4.3 requires guzzle/guzzle ~3.7.0 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4].
- aws/aws-sdk-php 2.4.4 requires guzzle/guzzle ~3.7.0 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4].
- aws/aws-sdk-php 2.4.5 requires guzzle/guzzle ~3.7.0 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4].
- aws/aws-sdk-php 2.4.6 requires guzzle/guzzle ~3.7.0 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4].
- aws/aws-sdk-php 2.4.7 requires guzzle/guzzle ~3.7.0 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4].
- aws/aws-sdk-php 2.4.8 requires guzzle/guzzle ~3.7.0 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4].
- aws/aws-sdk-php 2.4.9 requires guzzle/guzzle ~3.7.0 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4].
- aws/aws-sdk-php 2.5.0 requires guzzle/guzzle >=3.7.0,<3.9.0 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1].
- aws/aws-sdk-php 2.5.1 requires guzzle/guzzle >=3.7.0,<3.9.0 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1].
- aws/aws-sdk-php 2.5.2 requires guzzle/guzzle >=3.7.0,<3.9.0 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1].
- aws/aws-sdk-php 2.5.3 requires guzzle/guzzle >=3.7.0,<3.9.0 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1].
- aws/aws-sdk-php 2.5.4 requires guzzle/guzzle >=3.7.0,<3.9.0 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1].
- aws/aws-sdk-php 2.6.0 requires guzzle/guzzle >=3.7.0,<3.9.0 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1].
- aws/aws-sdk-php 2.6.1 requires guzzle/guzzle >=3.7.0,<=3.9.9 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1, v3.9.0, v3.9.1, v3.9.2].
- aws/aws-sdk-php 2.6.10 requires guzzle/guzzle >=3.7.0,<=3.9.9 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1, v3.9.0, v3.9.1, v3.9.2].
- aws/aws-sdk-php 2.6.11 requires guzzle/guzzle >=3.7.0,<=3.9.9 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1, v3.9.0, v3.9.1, v3.9.2].
- aws/aws-sdk-php 2.6.12 requires guzzle/guzzle >=3.7.0,<=3.9.9 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1, v3.9.0, v3.9.1, v3.9.2].
- aws/aws-sdk-php 2.6.13 requires guzzle/guzzle >=3.7.0,<=3.9.9 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1, v3.9.0, v3.9.1, v3.9.2].
- aws/aws-sdk-php 2.6.14 requires guzzle/guzzle >=3.7.0,<=3.9.9 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1, v3.9.0, v3.9.1, v3.9.2].
- aws/aws-sdk-php 2.6.15 requires guzzle/guzzle >=3.7.0,<=3.9.9 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1, v3.9.0, v3.9.1, v3.9.2].
- aws/aws-sdk-php 2.6.2 requires guzzle/guzzle >=3.7.0,<=3.9.9 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1, v3.9.0, v3.9.1, v3.9.2].
- aws/aws-sdk-php 2.6.3 requires guzzle/guzzle >=3.7.0,<=3.9.9 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1, v3.9.0, v3.9.1, v3.9.2].
- aws/aws-sdk-php 2.6.4 requires guzzle/guzzle >=3.7.0,<=3.9.9 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1, v3.9.0, v3.9.1, v3.9.2].
- aws/aws-sdk-php 2.6.5 requires guzzle/guzzle >=3.7.0,<=3.9.9 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1, v3.9.0, v3.9.1, v3.9.2].
- aws/aws-sdk-php 2.6.6 requires guzzle/guzzle >=3.7.0,<=3.9.9 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1, v3.9.0, v3.9.1, v3.9.2].
- aws/aws-sdk-php 2.6.7 requires guzzle/guzzle >=3.7.0,<=3.9.9 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1, v3.9.0, v3.9.1, v3.9.2].
- aws/aws-sdk-php 2.6.8 requires guzzle/guzzle >=3.7.0,<=3.9.9 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1, v3.9.0, v3.9.1, v3.9.2].
- aws/aws-sdk-php 2.6.9 requires guzzle/guzzle >=3.7.0,<=3.9.9 -> satisfiable by guzzle/guzzle[v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1, v3.9.0, v3.9.1, v3.9.2].
- aws/aws-sdk-php 2.3.4 requires guzzle/guzzle ~3.6.0 -> satisfiable by guzzle/guzzle[v3.6.0].
- aws/aws-sdk-php 2.3.1 requires guzzle/guzzle ~3.4.3 -> satisfiable by guzzle/guzzle[v3.4.3].
- aws/aws-sdk-php 2.3.2 requires guzzle/guzzle >=3.4.3,<4 -> satisfiable by guzzle/guzzle[v3.4.3, v3.5.0, v3.6.0, v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1, v3.9.0, v3.9.1, v3.9.2].
- aws/aws-sdk-php 2.3.3 requires guzzle/guzzle >=3.4.3,<4 -> satisfiable by guzzle/guzzle[v3.4.3, v3.5.0, v3.6.0, v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1, v3.9.0, v3.9.1, v3.9.2].
- aws/aws-sdk-php 2.3.0 requires guzzle/guzzle ~3.4.1 -> satisfiable by guzzle/guzzle[v3.4.1, v3.4.2, v3.4.3].
- aws/aws-sdk-php 2.2.0 requires guzzle/guzzle ~3.3.0 -> satisfiable by guzzle/guzzle[v3.3.0, v3.3.1].
- aws/aws-sdk-php 2.2.1 requires guzzle/guzzle ~3.3.0 -> satisfiable by guzzle/guzzle[v3.3.0, v3.3.1].
- aws/aws-sdk-php 2.1.1 requires guzzle/guzzle ~3.2.0 -> satisfiable by guzzle/guzzle[v3.2.0].
- aws/aws-sdk-php 2.1.2 requires guzzle/guzzle ~3.2.0 -> satisfiable by guzzle/guzzle[v3.2.0].
- aws/aws-sdk-php 2.1.0 requires guzzle/guzzle ~3.1.2 -> satisfiable by guzzle/guzzle[v3.1.2].
- guzzle/guzzle v3.9.2 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- guzzle/guzzle v3.9.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- guzzle/guzzle v3.9.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- guzzle/guzzle v3.8.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- guzzle/guzzle v3.8.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- guzzle/guzzle v3.7.4 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- guzzle/guzzle v3.7.3 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- guzzle/guzzle v3.7.2 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- guzzle/guzzle v3.7.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- guzzle/guzzle v3.7.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- guzzle/guzzle v3.6.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- guzzle/guzzle v3.5.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- guzzle/guzzle v3.4.3 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- guzzle/guzzle v3.4.2 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- guzzle/guzzle v3.4.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- guzzle/guzzle v3.3.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- guzzle/guzzle v3.3.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- aws/aws-sdk-php-laravel 1.0.2 requires laravel/framework 4.0.* -> no matching package found.
- aws/aws-sdk-php-laravel 1.0.1 requires laravel/framework 4.0.* -> no matching package found.
- guzzle/guzzle v3.2.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- guzzle/guzzle v3.1.2 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- aws/aws-sdk-php-laravel 1.0.0 requires laravel/framework 4.0.* -> no matching package found.
- Installation request for aws/aws-sdk-php-laravel 1.* -> satisfiable by aws/aws-sdk-php-laravel[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.1.0, 1.1.1].

AWS::get should not return void

The AWS get method should be documented to return Mixed or (haven't really looked into this one) ClientInterface.

It's not a big issue, but the void method 'get' result used errors from our ide's are getting a bit old!

How can I dynamic change object options?

$object = AWS::createClient('s3');

I create a object about s3, and the region is us-east-1. I want to dynamic change the region to ap-southeast-1 or others. So, How can I do that? I use get_class_methods method to print $object all functions, and I find factory method, But it does not work.

$object->factory([
    'region' => 'ap-southeast-1',
    'scheme' => 'http',
    'version' => 'latest'
]);

Changing AWS Keys in Run Time

Hi,

In a multi-tenant setup , its required that we switch the AWS keys of the tenant.

So far its possible to achieve this via a simple

   Config::set('aws::key', $tenant->key);
   Config::set('aws::secret', $tenant->secret);

But I have come across an instance where this doesn't work. I can't seem to make sense as to why this happens , the config variables are empty if I debug the Service provider at this point.

   App::make('aws')->factory($tenant_aws_config)->get('sns');

Doing the above resolve the problem for now, but it doesn't help me understand how this is caused.

Do advise me if any of you guys have come across such a scenario.

Regards,

Gayan

PutObjectAcl error

I am trying to update the ACL for an existing item:

$s3 = AWS::get('s3');

return $s3->putObjectACL([
  'ACL' => 'public-read',
  'Bucket' => mybucket,
  'Key' => /path/to/my/object,
]);

However, I am getting the following error:

{
"error":{"type":"Guzzle\\Common\\Exception\\InvalidArgumentException",
"message":"Command was not found matching PutObjectACL",
"file":"\\htdocs\\deqoy\\vendor\\guzzle\\guzzle\\src\\Guzzle\\Service\\Client.php",
"line":87}
}

This seems to indicate that the PutObjectAcl method doesn't exist.

Am I missing something obvious here?

extra info for the readme

Hi,

To read ec2 instances use this code:

$ec2 = AWS::get('ec2');

$client = $ec2::factory(array(
    'region' => 'eu-west-1',
    'key'      => '{{KEY}}',
    'secret'   => '{{ADD YOUR KEY}}'
));

$result = $client->describeInstances();
$data = $result->toArray();
print_r($data);

Incorrect Composer Settings via Readme

"aws/aws-sdk-php-laravel": "~2.0"
~2.0 does not work because of stability flags. For usage sake could we change the readme to tell people use either:
"aws/aws-sdk-php-laravel": "~2.0@beta"
"aws/aws-sdk-php-laravel": "dev-master"

what is this object Key

Hi, I have follow the instruction but i am getting errors regarding the "YOUR_OBJECT_KEY"

$filename = \rand() .''. ImageService::mt_rand_str(15). ''. time(). '_s';
try {
$s3 = \AWS::createClient('s3');
$s3->putObject(array(
'Bucket' => 'hprofile-uda1',
'key' => $filename,
'SourceFile' => $temp_path.'/'.$filename,
'ACL' => 'public-read',
'StorageClass' => 'REDUCED_REDUNDANCY'
));
} catch (\AWS\Exception\S3Exception $e) {
echo "There was an error uploading the file.\n";
}

I successfully dont know what the key is might to be and i have tried both my access key, secret key and bucket name.

I keep getting this error
Found 1 error while validating the input provided for the PutObject operation:
[Key] is missing and is a required parameter

I have read http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html and it says "When you create an object, you specify the key name, which uniquely identifies the object in the bucket." i have done this

S3 bucket problem with non us/eu regions

Hi,

I am getting the below exception when ever I use 'sa-east-1, ap-northeast-1, ap-southeast-1, ap-southeast-2' regions to create a bucket via PHP.

Aws \ S3 \ Exception \ S3Exception
The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.

Here is the snippet i tested with :

My default region is set to 'ap-southeast-1'. I would prefer to have the region set to Singapore since the application serves Singapore.

I am not certain if its a bug. According to ( http://docs.aws.amazon.com/general/latest/gr/rande.html ) the ap-southeast-1 seems to have a valid endpoint.

Route::get('test', function(){
    $s3 = App::make('aws')->get('s3');
    $s3->setRegion('sa-east-1');
        if (! $s3->doesBucketExist('my-new-bucket')) {
            $s3->createBucket(array('Bucket' => 'my-new-bucket'));
        }

        $blist = $s3->listBuckets();
        echo "   Buckets belonging to " . $blist['Owner']['ID'] . ":\n";
        foreach ($blist['Buckets'] as $b) {
            echo "{$b['Name']}\t{$b['CreationDate']}\n";
        }
});

SDK working with master credentials but not with IAM

I posted this issue on the general aws-sdk-php repository: aws/aws-sdk-php#524, but after further research I found out that the issue must be only with the AWS Service Provider for Laravel 4. When using the master key/secret everything works. However, when using the IAM key/secret I constantly receive:

AWS Error Code: SignatureDoesNotMatch, Status Code: 403, AWS Request ID: 4753C8291E073CE9, AWS Error Type: client, AWS Error Message: The request signature we calculated does not match the signature you provided. Check your key and signing method.

I tested with the same IAM user credentials(key/secret) with the aws-sdk-php and everything works. Here is the request and the response:

# Request:
PUT /testfile.txt HTTP/1.1
Host: esquireprod.s3-us-west-2.amazonaws.com
x-amz-acl: public-read
Content-Type: text/plain
Content-MD5: 2UY2sCtfw4i/iNjVn28myA==
User-Agent: aws-sdk-php2/2.7.24 Guzzle/3.9.3 curl/7.22.0 PHP/5.5.20-1+deb.sury.org~precise+1 Laravel/4.2.17 L4MOD/1.1.0
Date: Mon, 30 Mar 2015 00:31:31 +0000
Authorization: AWS AKIAIM43ZC4YWNBD6S6A:m6uzQ+odmuKmtE8D8TIbKI3LNQE=
Content-Length: 32

Some test content in the file...

# Response:
HTTP/1.1 403 Forbidden
x-amz-request-id: 87AA985EC92E6EB0
x-amz-id-2: pYVZpGy10y52KmNewF4sSZYDkB5Uem8GNx1qRee/gwF2TqVcL131i9yDaa/2VSEsV/GfgfOGRys=
Content-Type: application/xml
Transfer-Encoding: chunked
Date: Mon, 30 Mar 2015 00:31:31 GMT
Connection: close
Server: AmazonS3

<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message><AWSAccessKeyId>AKIAIM43ZC4YWNBD6S6A</AWSAccessKeyId><StringToSign>PUT
2UY2sCtfw4i/iNjVn28myA==
text/plain
Mon, 30 Mar 2015 00:31:31 +0000
x-amz-acl:public-read
/esquireprod/testfile.txt</StringToSign><SignatureProvided>m6uzQ+odmuKmtE8D8TIbKI3LNQE=</SignatureProvided><StringToSignBytes>50 55 54 0a 32 55 59 32 73 43 74 66 77 34 69 2f 69 4e 6a 56 6e 32 38 6d 79 41 3d 3d 0a 74 65 78 74 2f 70 6c 61 69 6e 0a 4d 6f 6e 2c 20 33 30 20 4d 61 72 20 32 30 31 35 20 30 30 3a 33 31 3a 33 31 20 2b 30 30 30 30 0a 78 2d 61 6d 7a 2d 61 63 6c 3a 70 75 62 6c 69 63 2d 72 65 61 64 0a 2f 65 73 71 75 69 72 65 70 72 6f 64 2f 74 65 73 74 66 69 6c 65 2e 74 78 74</StringToSignBytes><RequestId>87AA985EC92E6EB0</RequestId><HostId>pYVZpGy10y52KmNewF4sSZYDkB5Uem8GNx1qRee/gwF2TqVcL131i9yDaa/2VSEsV/GfgfOGRys=</HostId></Error>```

relocate config.php and include a default config file

To best work with laravel, the package config.php should be located in app/config/packages/aws/aws-sdk-php-laravel/config.php.

Also, if you can include a default configuration in src/config/config.php, laravel users can simply run
php artisan config:publish aws/aws-sdk-php-laravel and have the configuration automatically published to their project. This way they don't have to create the configuration manually, and can just open it and update the values.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.