PHP remains common for back offices, invoicing systems and internal tools — the kind of software that generates a batch of files and needs to hand users a single archive. The S3zipper API fits the same pattern as any other HTTP call.
1. Get a token
2. Start the zip
$payload = [
"awsKey" => getenv("AWS_ACCESS_KEY_ID"),
"awsSecret" => getenv("AWS_SECRET_ACCESS_KEY"),
"awsBucket" => "my-bucket",
"awsRegion" => "us-east-1",
"filePaths" => ["my-bucket/invoices/2026-10"],
"zipFileName" => "invoices-2026-10.zip",
];
$start = json_decode(
request("POST", "https://api.s3zipper.com/v1/zipstart", $auth, json_encode($payload)),
true
);
echo "Queued: " . $start["taskUUID"][0]["streams3v2"];
3. Wait and fetch the link
for ($i = 0; $i < 120; $i++) {
$state = json_decode(
request("POST", "https://api.s3zipper.com/v1/zipstate", $auth, json_encode($start)),
true
);
if (in_array($state["State"], ["SUCCESS", "FAILURE"], true)) break;
sleep(2);
}
$result = json_decode(
request("POST", "https://api.s3zipper.com/v1/zipresult", $auth, json_encode($start)),
true
);
$url = $result["results"][0];
Redirect or link the user to $url. It is a signed S3 link that expires; requesting it again returns the same URL.
Notes
- Reuse
$tokenwithin one request cycle; it is valid for a day. - For large archives, do not block a PHP request on the loop — queue the job id and check it later, or use
resultsEmail. - Store credentials outside the repository; hard-coded keys are the most common cause of leaked S3 data.