Note: This library is under active development as I expand it to cover Cloudflare API. Consider the public API of this package a little unstable as I work towards a v1.0. See Coverage.

Routes

Cloudflare API docs

List

Returns routes for a zone.

php
$response = $client->workers()->routes()->get('zone_id');

Create

Creates a route that maps a URL pattern to a Worker.

php
$response = $client->workers()->routes()->create('zone_id', [
    'pattern' => 'example.net/*',
    'script' => 'this-is_my_script-01'
]);

Get

Returns information about a route, including URL pattern and Worker.

php
$response = $client->workers()->routes()->details('zone_id', 'route_id');

Update

Updates the URL pattern or Worker associated with a route.

php
$response = $client->workers()->routes()->update('zone_id', 'route_id', [
    'pattern' => 'example.net/*',
    'script' => 'this-is_my_script-01'
]);

Delete

Deletes a route.

php
$response = $client->workers()->routes()->delete('zone_id', 'route_id');
Table of Contents