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.

Members

On any Cloudflare account, you can collaborate by adding members to your account and assigning them access via one or several policies.

Cloudflare API docs

List

List all members of an account.

php
$response = $client->accounts()->members()->list('ACCOUNT_ID');

Add

Add a user to the list of members for this account.

php
$values = [
    'email' => '[email protected]',
    'roles' => 'the role'
];

$response = $client->accounts()->members()->add('ACCOUNT_ID', $values);

Details

Get informationabout a specific member of an account.

php
$response = $client->accounts()->members()->details('ACCOUNT_ID', 'MEMBER_ID');

Update

Modify an account member.

Update roles

php

$roles = [
    [
        "id" => "role_id_1"
    ],
    [
        "id" => "role_id_2"
    ]
];
$response = $client->accounts()->members()->updateRoles('ACCOUNT_ID', 'MEMBER_ID', $roles);

Update policies

php

$policies = [
    [
        'access' => 'allow',
        'permission_groups' => [
            [
                "id" => "permission_group_id"
            ]
        ],
        "resource_groups" => [
            "id" => "resource_group_id"
        ]
    ]
];
$response = $client->accounts()->members()->updatePolicies('ACCOUNT_ID', 'MEMBER_ID', $policies);

Remove

Remove a member from an account.

php
$response = $client->accounts()->members()->delete('ACCOUNT_ID', 'MEMBER_ID');