title: How do I get an "offset" in an AWS S3 object version listing?
body: <p>Here is my method:</p>
  
  <pre><code>public function listVersionsForPath($s3Path, $bucketName, $offset, $limit) {
      $versions = array();
  
      $tmpS3Path = $this-&gt;cleanS3Path($s3Path);
      $fullBucketName = self::getFullBucketName($bucketName);
  
      $request = array(
          'Bucket' =&gt; $fullBucketName,
          'Prefix' =&gt; $tmpS3Path,
          'MaxKeys' =&gt; 100,
          'VersionIdMarker' =&gt; ???,
      );
  
      $iterator = $this-&gt;client-&gt;getListObjectVersionsIterator($request);
  
      foreach ($iterator as $object) {
          if(!isset($versions[$object['Key']])) {
              $versions[$object['Key']] = array();
          }
          $versions[$object['Key']][] = $object['VersionId'];
      }
  
      return $versions;
  }
  </code></pre>
  
  <p>I need to limit the number of versions returned to at least 100 because I had an object with 1000+ versions that crashed PHP forthright. However, I have no idea how to skip the first 100 versions, get them out of memory, and then load the next 100.</p>
  
  <p><strong>Finally</strong>, I found at least somewhat of a list for all the valid options in an S3 request. If you open S3Client.php in the aws.phar, on line 184 there is a list of what AWS has as the equivalent of 'offset'. Basically, you have to grab a listing of objects and then set the offset to the value of the last key from the previous listing. I have not been able to do this myself yet, I'm using a continue; and a break; for fake pagination.</p>