Gaufrette\Adapter\AwsS3::getUrl PHP Method

getUrl() public method

Gets the publicly accessible URL of an Amazon S3 object.
public getUrl ( string $key, array $options = [] ) : string
$key string Object key
$options array Associative array of options used to buld the URL - expires: The time at which the URL should expire represented as a UNIX timestamp - Any options available in the Amazon S3 GetObject operation may be specified.
return string
    public function getUrl($key, array $options = array())
    {
        return $this->service->getObjectUrl($this->bucket, $this->computePath($key), isset($options['expires']) ? $options['expires'] : null, $options);
    }

Usage Example

Example #1
0
 /**
  * Returns the url for file
  * By default absolute path to file is returned
  * Otherwise when $options array contain key `relative` set as true, relative path will be returned
  *
  * @param $key
  * @param array $options
  * @return mixed
  */
 public function getUrl($key, array $options = [])
 {
     $url = parent::getUrl($key, $options);
     if (isset($options['relative']) && $options['relative']) {
         $url = parse_url($url, PHP_URL_PATH);
     }
     return $url;
 }
All Usage Examples Of Gaufrette\Adapter\AwsS3::getUrl