PHPackages                             typisttech/cloudflare-wp-api - 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. typisttech/cloudflare-wp-api

Abandoned → [cloudflare/sdk](/?search=cloudflare%2Fsdk)ArchivedLibrary

typisttech/cloudflare-wp-api
============================

WordPress HTTP API replacement of the jamesryanbell/cloudflare package.

0.3.0(9y ago)224.6k[2 issues](https://github.com/typisttech/cloudflare-wp-api/issues)1GPL-2.0+PHPPHP ^7.0

Since Feb 25Pushed 8y ago1 watchersCompare

[ Source](https://github.com/typisttech/cloudflare-wp-api)[ Packagist](https://packagist.org/packages/typisttech/cloudflare-wp-api)[ Docs](https://github.com/TypistTech/cloudflare-wp-api)[ RSS](/packages/typisttech-cloudflare-wp-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (6)Used By (1)

Cloudflare WP API
=================

[](#cloudflare-wp-api)

[![Latest Stable Version](https://camo.githubusercontent.com/67bac5e95f21f3c82626899d111efb7d11348601920927050b749b3e11b0f7a4/68747470733a2f2f706f7365722e707567782e6f72672f747970697374746563682f636c6f7564666c6172652d77702d6170692f762f737461626c65)](https://packagist.org/packages/typisttech/cloudflare-wp-api)[![Total Downloads](https://camo.githubusercontent.com/e878843bdfc51ce91efa7d394679baf09f4e7494e89f3fa59066d91a6c9aa4f4/68747470733a2f2f706f7365722e707567782e6f72672f747970697374746563682f636c6f7564666c6172652d77702d6170692f646f776e6c6f616473)](https://packagist.org/packages/typisttech/cloudflare-wp-api)[![Build Status](https://camo.githubusercontent.com/3804d4f21c055ff9dec122faeea5413e252f7f4f6cb05ec7c2c7995f246c0fcd/68747470733a2f2f7472617669732d63692e6f72672f547970697374546563682f636c6f7564666c6172652d77702d6170692e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/TypistTech/cloudflare-wp-api)[![codecov](https://camo.githubusercontent.com/3f200f0382cc2165230f84740841d0cdc1421a11ece6d514b949fc9a30674b10/68747470733a2f2f636f6465636f762e696f2f67682f547970697374546563682f636c6f7564666c6172652d77702d6170692f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/TypistTech/cloudflare-wp-api)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/9ebba719ce32d7a7f3d40b160cd365c412cd456fb2a60be7e3d8ea039cb6a5cd/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f547970697374546563682f636c6f7564666c6172652d77702d6170692f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/TypistTech/cloudflare-wp-api/?branch=master)[![PHP Versions Tested](https://camo.githubusercontent.com/c7154591cc32334e72e5ba05a3b179603ab6aa61fb53c5d4c0f6cb23fce15003/687474703a2f2f7068702d6579652e636f6d2f62616467652f747970697374746563682f636c6f7564666c6172652d77702d6170692f7465737465642e737667)](https://travis-ci.org/TypistTech/cloudflare-wp-api)[![StyleCI](https://camo.githubusercontent.com/8de1beffe0eec322b7d50fb1350d64cb3bd46c89f841dcc81a8d66d21cd4991d/68747470733a2f2f7374796c6563692e696f2f7265706f732f38333039373536352f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/83097565)[![Dependency Status](https://camo.githubusercontent.com/4e529e5ac722d1e533db444c84461f8b9af134bf2678c4a8200b5319b5a5fbc6/68747470733a2f2f67656d6e617369756d2e636f6d2f6261646765732f6769746875622e636f6d2f547970697374546563682f636c6f7564666c6172652d77702d6170692e737667)](https://gemnasium.com/github.com/TypistTech/cloudflare-wp-api)[![License](https://camo.githubusercontent.com/e791af05129fd9353352ddea829ea6428b5c6307a2f85092172c24f7dbe9a6ad/68747470733a2f2f706f7365722e707567782e6f72672f747970697374746563682f636c6f7564666c6172652d77702d6170692f6c6963656e7365)](https://packagist.org/packages/typisttech/cloudflare-wp-api)[![Donate via PayPal](https://camo.githubusercontent.com/b57c445af971e3e99c2d0ccdbf4fa7faa4358ba27fecc8f68459b30289f82eda/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f6e6174652d50617950616c2d626c75652e737667)](https://www.typist.tech/donate/cloudflare-wp-api/)[![Hire Typist Tech](https://camo.githubusercontent.com/e392a964bbdc0c32d95825bbc8253027387bcb9b021176d807d22ac75d86f308/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f486972652d547970697374253230546563682d6666363962342e737667)](https://www.typist.tech/contact/)

WordPress HTTP API replacement of the [jamesryanbell/cloudflare](https://packagist.org/packages/jamesryanbell/cloudflare) package.

- [Why use `WP HTTP API` instead of `curl`?](#why-use-wp-http-api-instead-of-curl)
- [Install](#install)
- [Usage](#usage)
    - [Successful responses](#successful-responses)
    - [Error responses](#error-responses)
- [Start Developing](#start-developing)
- [Running the Tests](#running-the-tests)
- [Feedback](#feedback)
- [Change log](#change-log)
- [Contributing](#contributing)
- [Security](#security)
- [Credits](#credits)
- [License](#license)

Why use `WP HTTP API` instead of `curl`?
----------------------------------------

[](#why-use-wp-http-api-instead-of-curl)

`curl` is great. However, it is not always available on every hosts, especially shared hosting. Using [WordPress HTTP API](https://developer.wordpress.org/plugins/http-api/) lets WordPress figure out the best way to make HTTP requests. It could be `curl` or something else. You don't need to care about it. See [WordPress codex](https://codex.wordpress.org/HTTP_API).

Install
-------

[](#install)

Installation should be done via composer, details of how to install composer can be found at .

```
$ composer require typisttech/cloudflare-wp-api
```

Since the [jamesryanbell/cloudflare](https://packagist.org/packages/jamesryanbell/cloudflare) package doesn't provide a way to inject client objects, we have to rename `Cloudflare\Api` to `Cloudflare\BaseApi`. And, use our [`Api`](src/Api.php) class instead

```
$ vendor/bin/cfwp build
```

You have to run the command on every `composer install` and `composer update`. A better way to do so is to add this command to `composer.json` like so:

```
  "scripts": {
    "post-install-cmd": "cfwp build",
    "post-update-cmd": "cfwp build"
  }
```

Usage
-----

[](#usage)

Once `$ cfwp build` is done, you can use it exactly the same as the original package.

See [jamesryanbell/cloudflare](https://github.com/jamesryanbell/cloudflare) for more details about the original package.

### Successful responses

[](#successful-responses)

Decode **body** array from `wp_remote_request`.

### Error responses

[](#error-responses)

`WP_Error` object. Maybe returned from `wp_remote_request`, or one of the followings:

CodeMessageDataauthentication-errorAuthentication information must be providedauthentication-errorEmail is not validdecode-errorResponse errors is not an arrayresponseOr, one of the Coudlfare defined error codes, here is some example:

CodeMessageData1012Request must contain one of 'purge\_everything' or 'files'response1210That operation is no longer allowed for that domainresponseStart Developing
----------------

[](#start-developing)

This command will clone the project source code from GitHub and install its dependencies.

```
$ composer create-project --no-install --prefer-source --keep-vcs typisttech/cloudflare-wp-api:dev-master
$ cd cloudflare-wp-api
$ composer install
```

Running the Tests
-----------------

[](#running-the-tests)

[Cloudflare WP API](https://github.com/TypistTech/cloudflare-wp-api) run tests on [Codeception](http://codeception.com/) and relies [wp-browser](https://github.com/lucatume/wp-browser) to provide WordPress integration. Before testing, you have to install WordPress locally and add a [codeception.yml](http://codeception.com/docs/reference/Configuration) file. See [codeception.example.yml](codeception.example.yml) for a [Varying Vagrant Vagrants](https://varyingvagrantvagrants.org/) configuration example.

Actually run the tests:

```
$ composer test
```

We also test all PHP files against [PSR-2: Coding Style Guide](http://www.php-fig.org/psr/psr-2/) and part of the [WordPress coding standard](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards).

Check the code style with `$ composer check-style` and fix it with `$ composer fix-style`.

Feedback
--------

[](#feedback)

**Please provide feedback!** We want to make this library useful in as many projects as possible. Please submit an [issue](https://github.com/TypistTech/cloudflare-wp-api/issues/new) and point out what you do and don't like, or fork the project and make suggestions. **No issue is too small.**

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) and [CONDUCT](.github/CONDUCT.md) for details.

Credits
-------

[](#credits)

[Cloudflare WP API](https://github.com/TypistTech/cloudflare-wp-api) is a [Typist Tech](https://www.typist.tech) project and maintained by [Tang Rufus](https://twitter.com/Tangrufus), freelance developer for [hire](https://www.typist.tech/contact/).

Full list of contributors can be found [here](https://github.com/TypistTech/cloudflare-wp-api/graphs/contributors).

Special thanks to [James Bell](https://james-bell.co.uk/) whose [Cloudflare package](https://packagist.org/packages/jamesryanbell/cloudflare) make this project possible.

License
-------

[](#license)

[Cloudflare WP API](https://github.com/TypistTech/cloudflare-wp-api) is licensed under the GPLv2 (or later) from the [Free Software Foundation](http://www.fsf.org/). Please see [License File](LICENSE) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~1 days

Total

5

Last Release

3355d ago

### Community

Maintainers

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

---

Top Contributors

[![tangrufus](https://avatars.githubusercontent.com/u/2259834?v=4)](https://github.com/tangrufus "tangrufus (62 commits)")

---

Tags

cloudflare-php-apicomposer-packageswordpresswordpress-developmentwordpress-php-librarywordpresscloudflaretypisttechcloudflare-wp-api

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/typisttech-cloudflare-wp-api/health.svg)

```
[![Health](https://phpackages.com/badges/typisttech-cloudflare-wp-api/health.svg)](https://phpackages.com/packages/typisttech-cloudflare-wp-api)
```

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.0k17.2M319](/packages/wp-cli-wp-cli)[wp-coding-standards/wpcs

PHP\_CodeSniffer rules (sniffs) to enforce WordPress coding conventions

2.7k42.5M1.6k](/packages/wp-coding-standards-wpcs)[composer/installers

A multi-framework Composer library installer

1.4k136.0M6.0k](/packages/composer-installers)[phpcompatibility/phpcompatibility-wp

A ruleset for PHP\_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.

21830.6M584](/packages/phpcompatibility-phpcompatibility-wp)[szepeviktor/phpstan-wordpress

WordPress extensions for PHPStan

3257.8M892](/packages/szepeviktor-phpstan-wordpress)[php-stubs/wordpress-stubs

WordPress function and class declaration stubs for static analysis.

19013.0M263](/packages/php-stubs-wordpress-stubs)

PHPackages © 2026

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