aws/aws-sdk-php-zf2 — pull request #7 by bakura10 (2013-05-18 14:30:41+00:00)
Title: Add S3 helper

Hi,

I may be completely wrong, but until now, what I've done is simply storing the full path to the S3 object in my database. However it's a mess when you want to go to CloudFront to change the links everywhere.

So now I just store the bucket name and the object name. Therefore I thought it would be nice to have a view helper that would generate a link to an S3 object, and be able to configure the view helper to use CloudFront, so that all links are automatically changed to CloudFront.

Basic usage would be:

```php
s3Link('/media/file.css', 'my-bucket'); ?>
// Output 'https://my-bucket.s3.amazonaws.com/media/file.css'

// If it's configured to CloudFront, bucket become optional:
s3Link('/media/file.css', 'my-bucket'); ?>
// Output 'https://domainname.cloudfront.net/media/file.css'
```

What do you think of such a feature?

Before merging I'd like to add an option to sign URL, as well as an option to map a bucket name to a cloudfront domain (I think this can be a problem, people using two s3 buckets I suppose they have two cloudfront domain to avoid name clashes).

I'm just not really satisfied with the naming, as s3Link *may* output a cloudfront link, but this is the only solution I've found to change ALL the links by simply changing in option in the config (but it may lead to side-effects ? So maybe it's simpler to write two differnet helpers ?.

ping @ocramius too for his nice ideas everytime =)