listObjects([ 'Bucket' => self::getBucket(), 'Prefix' => 'invoice_' . $invoice_id . '.pdf' ]); return count($objects['Contents'] ?? []) > 0; } public function getInvoiceDownloadUrl(int|string $id): string { return self::getPresignedUrl('invoice_' . $id . '.pdf'); } /** * @param string $file * @return string The path to the downloaded file */ public function download(string $file): string { $path = '/tmp/' . $file; $result = self::getS3Client()->getObject([ 'Bucket' => self::getBucket(), 'Key' => $file, 'SaveAs' => $path ]); return $path; } public function isFileInStore(string $file): bool { return self::getS3Client()->doesObjectExist(self::getBucket(), $file); } }