title: List objects in S3 bucket
body: <p>I am trying to list all files in a bucket.</p>
  
  <p>This returns empty array:</p>
  
  <pre><code>$objects = $s3Client-&gt;getIterator('ListObjects', array(
      "Bucket" =&gt; "mybucket",
      "Prefix" =&gt; "/sub/folder/"
  ));
  </code></pre>
  
  <p>And this...</p>
  
  <pre><code>$objects = $s3Client-&gt;listObjects(['Bucket' =&gt; "mybucket", 'Prefix' =&gt; "/sub/folder/"]);
  </code></pre>
  
  <p>... returns this:</p>
  
  <pre><code>Aws\Result Object
  (
      [data:Aws\Result:private] =&gt; Array
          (
              [IsTruncated] =&gt; 
              [Marker] =&gt; 
              [Name] =&gt; mybucket
              [Prefix] =&gt; /sub/folder/
              [MaxKeys] =&gt; 1000
              [EncodingType] =&gt; url
              [@metadata] =&gt; Array
                  (
                      [statusCode] =&gt; 200
                      [effectiveUri] =&gt; https://s3.amazonaws.com/mybucket?prefix=%2Fsub%2Ffolder%2F&amp;encoding-type=url
                      [headers] =&gt; Array
                          (
                              [x-amz-id-2] =&gt; ........
                              [x-amz-request-id] =&gt; .....
                              [date] =&gt; Sat, 01 Feb 2020 14:19:02 GMT
                              [x-amz-bucket-region] =&gt; us-east-1
                              [content-type] =&gt; application/xml
                              [server] =&gt; AmazonS3
                              [connection] =&gt; close
                          )
  
                      [transferStats] =&gt; Array
                          (
                              [http] =&gt; Array
                                  (
                                      [0] =&gt; Array
                                          (
                                          )
  
                                  )
  
                          )
  
                  )
  
          )
  
      [monitoringEvents:Aws\Result:private] =&gt; Array
          (
          )
  
  )
  </code></pre>
  
  <p>There are five files in this bucket. The bucket is public, and I have tried already listing the root. But I get the same results.</p>