PHPackages                             adweingarten/cloudflarephpsdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. adweingarten/cloudflarephpsdk

ActiveLibrary[Framework](/categories/framework)

adweingarten/cloudflarephpsdk
=============================

PHP client for interacting with CloudFlare's SDK. CloudFlare is a copyright of CloudFlare, Inc. The authors of this tool has no association with CloudFlare, Inc.

1.0.0(3y ago)84818[17 issues](https://github.com/adweingarten/cloudflarephpsdk/issues)[6 PRs](https://github.com/adweingarten/cloudflarephpsdk/pulls)GPL-2.0+PHPPHP &gt;=5.5.9

Since Oct 27Pushed 3y ago23 watchersCompare

[ Source](https://github.com/adweingarten/cloudflarephpsdk)[ Packagist](https://packagist.org/packages/adweingarten/cloudflarephpsdk)[ Docs](https://github.com/d8-contrib-modules/cloudflarephpsdk)[ RSS](/packages/adweingarten-cloudflarephpsdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (9)Versions (7)Used By (0)

Introduction
------------

[](#introduction)

Provides a PHP client to interact with Cloudflare API see: The SDK is designed to allow developers to work with CloudFlare without having to know all the low-level details of interacting with the API.

The API has been designed with ease of use in mind.

Note: CloudFlare is a trademark of CloudFlare Inc. This project is maintained independently of CloudFlare inc.

[![Automated Build](https://camo.githubusercontent.com/6143cc0578ff489954b2787a1a0c38f5a96c12ad6276942b6009393a4b6fc1ba/68747470733a2f2f7472617669732d63692e6f72672f64382d636f6e747269622d6d6f64756c65732f636c6f7564666c61726570687073646b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/d8-contrib-modules/cloudflarephpsdk) [![Latest Stable Version](https://camo.githubusercontent.com/b9bc02948563af1c5253a5f1bcba83c636d0267fee787171b128b9f345da59f4/68747470733a2f2f706f7365722e707567782e6f72672f64382d636f6e747269622d6d6f64756c65732f636c6f7564666c61726570687073646b2f762f737461626c65)](https://packagist.org/packages/d8-contrib-modules/cloudflarephpsdk) [![Total Downloads](https://camo.githubusercontent.com/866b698626bf22a877c08132ea5c6771174629dd33dfdc89cbf8856ea63ce9e7/68747470733a2f2f706f7365722e707567782e6f72672f64382d636f6e747269622d6d6f64756c65732f636c6f7564666c61726570687073646b2f646f776e6c6f616473)](https://packagist.org/packages/d8-contrib-modules/cloudflarephpsdk) [![Latest Unstable Version](https://camo.githubusercontent.com/f997145b04b17758031bde8d220636b6a75a6d67f31af8b8d2e6ca1fdd900c18/68747470733a2f2f706f7365722e707567782e6f72672f64382d636f6e747269622d6d6f64756c65732f636c6f7564666c61726570687073646b2f762f756e737461626c65)](https://packagist.org/packages/d8-contrib-modules/cloudflarephpsdk) [![License](https://camo.githubusercontent.com/7493f2768095456ff70e61029a2c60472419db497729e33588f6134551f7e1a2/68747470733a2f2f706f7365722e707567782e6f72672f64382d636f6e747269622d6d6f64756c65732f636c6f7564666c61726570687073646b2f6c6963656e7365)](https://packagist.org/packages/d8-contrib-modules/cloudflarephpsdk)

Usage
-----

[](#usage)

See below for some common uses of the API:

```
$api_key = 'your_cloudflare_api_key';
$user_email = 'your_cloudflare_email'
$api = new \Drupal\cloudflare\ZoneApi($api_key, $user_email );
$zoneId = $api->listZones()[0]->getZoneId();
$zone = $api->loadZone($zoneId);
$zone_settings = $zone-> getSettings();

$result = $api->purgeIndividualFiles($zoneId, array('path1'));
$result = $api->setSecurityLevel($zoneId, 'low');

```

Structure
---------

[](#structure)

### ApiTypes

[](#apitypes)

Parses incoming data from the API into typed data structures. Creating typed classes for the incoming data makes working with the API a lot simpler for Devs. It takes away the guess work for what's in an array.

### ApiEndPoints

[](#apiendpoints)

Provides facilities to interact with the remote api. Each API endpoint extends CloudFlareAPI. A new endpoint based off CloudFlareAPI gets a lot of the structural work necessary to make requests.

### Exceptions

[](#exceptions)

The SDK relies on an exception model for error handling. When an unexpected result occurs an exception is thrown. When developing with the SDK you will need to provide try-catch blocks to handle at the applicaiton level. Different exceptions are thrown based on the area of the SDK where the exception occurs.

### CloudFlareAPI.php

[](#cloudflareapiphp)

Provides facility for making webservice calls to cloudflare. It provides a wrapper around guzzle so that people using this module do not need to concern themselves with the low-level implementation details of guzzle.

Contribution Guidelines for Developers
--------------------------------------

[](#contribution-guidelines-for-developers)

### User proper namespacing

[](#user-proper-namespacing)

All code in this SDK is name-spaced inside CloudFlarePhpSdk using PSR-4 autoloading.

### Coding Standards

[](#coding-standards)

Contributed code must pass code sniffer.

### Type Hinting

[](#type-hinting)

Typehint all variables and parameters. It makes life a LOT simpler for developers working with IDEs.

### Unit Testing

[](#unit-testing)

The SDK has a goal of 100% PHPUnit test coverage. It normally hovers around 80% coverage. When submitting code please ensure that the change is either covered by existing tests OR provide new test!

### Travis CI

[](#travis-ci)

The repo is configured to work with Travis CI. All pull requests are automatically enqueued for automated testing. PRs must pass automated testing before being considered for integration.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 85.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~519 days

Recently: every ~627 days

Total

6

Last Release

1258d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c517d6b72025bbf6f570894c60127c953a866526c5d3474f0907cffa38e3905a?d=identicon)[aweingarten](/maintainers/aweingarten)

---

Top Contributors

[![aweingarten](https://avatars.githubusercontent.com/u/6517820?v=4)](https://github.com/aweingarten "aweingarten (40 commits)")[![nerdstein](https://avatars.githubusercontent.com/u/966547?v=4)](https://github.com/nerdstein "nerdstein (3 commits)")[![jhedstrom](https://avatars.githubusercontent.com/u/76833?v=4)](https://github.com/jhedstrom "jhedstrom (2 commits)")[![larowlan](https://avatars.githubusercontent.com/u/555254?v=4)](https://github.com/larowlan "larowlan (1 commits)")[![mglaman](https://avatars.githubusercontent.com/u/3698644?v=4)](https://github.com/mglaman "mglaman (1 commits)")

---

Tags

clientframeworkrestcurlhttp clientweb servicecloudflareCloud Flare

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/adweingarten-cloudflarephpsdk/health.svg)

```
[![Health](https://phpackages.com/badges/adweingarten-cloudflarephpsdk/health.svg)](https://phpackages.com/packages/adweingarten-cloudflarephpsdk)
```

###  Alternatives

[eightpoints/guzzle-wsse-middleware

WSSE Middleware for Guzzle, a PHP HTTP client library and framework for building RESTful web service clients

312.1M5](/packages/eightpoints-guzzle-wsse-middleware)[gregurco/guzzle-bundle-oauth2-plugin

OAuth2 Plugin for Guzzle Bundle, a PHP HTTP client library and framework for building RESTful web service clients

13348.3k](/packages/gregurco-guzzle-bundle-oauth2-plugin)[gregurco/guzzle-bundle-cache-plugin

Cache Plugin for Guzzle Bundle, a PHP HTTP client library and framework for building RESTful web service clients

11372.1k1](/packages/gregurco-guzzle-bundle-cache-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
