PHP Client for Cloudflare API
Workers

Deployment

A fluent configuration helper for building Workers Deployment payloads.

Usage

Cloudflare API provides extensive configuration for Workers Deployment, this helper aims to simplify it. addVersion() takes a percentage from 0 to 100; call it twice with two version IDs whose percentages add up to 100 to split traffic for a gradual rollout, or once at 100 to send everything to a single version.

php

use Cloudflare\Configurations\Workers\Deployment;

$deployment = new Deployment('This is a human-readable message about the deployment');

$deployment
    ->setMessage('This is a human-readable message about the deployment that overwrites the initial message.')
    ->addVersion('version_id', 100);

$response = $client->workers()->deployments()->create('account_id', 'script_name', $deployment);
Copyright © 2026