Search files via PHP SDK filtering with limit and date

0

I need to search files on AWS S3 storage using some filter:

  • range date
  • storage class
  • num max items

I'm using "aws/aws-sdk-php" : "^3.239" library

$objects = $this->client->getIterator('ListObjects', [
				'Bucket' => S3_BUCKET_NAME,
				'Prefix' => $folder,
				'MaxKeys' => 10,	// NOT WORKS
				'StorageClass' => "STANDARD"	// NOT WORKS
		]);

		foreach ($objects as $object) {	
			...
		}

Could you please support me?

Thanks L

luk3tt0
asked a year ago511 views
1 Answer
0

The Iterator method is for the php V2. If you are using PHP V3, could you try with the paginator. A Paginator is essentially an iterator of results. They are created via the getPaginator() method of the client.

Resources for review: [1]: https://docs.aws.amazon.com/zh_cn/aws-sdk-php/guide/latest/guide/paginators.html [2]: https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-Aws.AwsClientInterface.html#_getPaginator [3]: https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#listobjects

AWS
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions