PHPackages                             okwinza/cloudflare-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. [HTTP &amp; Networking](/categories/http)
4. /
5. okwinza/cloudflare-api

ActiveLibrary[HTTP &amp; Networking](/categories/http)

okwinza/cloudflare-api
======================

Simple yet flexible PHP library for CloudFlare API.

1.0.3(10y ago)1095.7kMITPHPPHP &gt;=5.3.3

Since Aug 4Pushed 9y ago2 watchersCompare

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

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

CloudFlare API
==============

[](#cloudflare-api)

[![Build Status](https://camo.githubusercontent.com/cd64b886660c6b3cd3301f3f03a5d226972803c3fae6cc80a7c3a2f926a76153/68747470733a2f2f7472617669732d63692e6f72672f6f6b77696e7a612f436c6f7564466c6172652d4150492e737667)](https://travis-ci.org/okwinza/CloudFlare-API)[![Latest Stable Version](https://camo.githubusercontent.com/cda3c8328e1ef6f4e9c10812302e0d8bec8a027c3f8f4b3d9ffce940326d429a/68747470733a2f2f706f7365722e707567782e6f72672f6f6b77696e7a612f636c6f7564666c6172652d6170692f762f737461626c65)](https://packagist.org/packages/okwinza/cloudflare-api)[![Total Downloads](https://camo.githubusercontent.com/f0e948483e973b63430d773d2592aeafe1d93b319e051ccbd4d318ff5325a882/68747470733a2f2f706f7365722e707567782e6f72672f6f6b77696e7a612f636c6f7564666c6172652d6170692f646f776e6c6f616473)](https://packagist.org/packages/okwinza/cloudflare-api)[![Latest Unstable Version](https://camo.githubusercontent.com/1ce326e74f954d2201029ddf70c6075fd11c7b362300c3a6983e83edfaf68bf8/68747470733a2f2f706f7365722e707567782e6f72672f6f6b77696e7a612f636c6f7564666c6172652d6170692f762f756e737461626c65)](https://packagist.org/packages/okwinza/cloudflare-api)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6ba3cde0aa689ef7705c46f154fd1d3ab72876e346f6dbe3c922e64809b87b33/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6f6b77696e7a612f636c6f7564666c6172652d6170692f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/okwinza/cloudflare-api/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/b9f58e30e4f0df251bc7959bf740e5720f5b37dad69b1cbb911d2e1ad8e1c1c9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6f6b77696e7a612f436c6f7564466c6172652d4150492f6261646765732f636f7665726167652e706e673f623d696e746567726174652d7465737473)](https://scrutinizer-ci.com/g/okwinza/CloudFlare-API/?branch=integrate-tests)[![License](https://camo.githubusercontent.com/faa6b9d276461d3467c3d5aa58c6c9192f7fe01509fbeae8d4cf951a97f1a7db/68747470733a2f2f706f7365722e707567782e6f72672f6f6b77696e7a612f636c6f7564666c6172652d6170692f6c6963656e7365)](https://packagist.org/packages/okwinza/cloudflare-api)

A small, compact but flexible API library for popular CDN provider [CloudFlare](http://cloudflare.com) written in PHP.

Supports both HOST and CLIENT APIs.

Docs
----

[](#docs)

[CloudFlare Client API documentation](https://www.cloudflare.com/docs/client-api.html)
[CloudFlare Hosting Provider API documentation](http://www.cloudflare.com/docs/host-api.html)

HOW TO
------

[](#how-to)

- Get yourself an API key. You can grab one [here](https://www.cloudflare.com/my-account).
- Replace {EMAIL} and {TOKEN} with your real data.
- Start coding.

Example
-------

[](#example)

You can find some demo code in /examples dir.

But still, here are the basics:

If you want to use CLIENT API then instantiate API object like this:

```
$cf_api_client = new CF("{EMAIL}","{TOKEN}");

```

Otherwise just pass your {HOST\_KEY} to the constructor:

```
$cf_api_client = new CF("{HOST_KEY}");

```

And start making requests:

```
    $response = $cf_api_client->rec_new(array(
        'z' => 'yoursite.com',
        'name' => 'new.yoursite.com',
        'ttl' => 1,
        'type' => 'A',
        'content' => '1.2.3.4'
    ));

```

Note: `rec_new` is a name of api method listed in [docs](https://github.com/okwinza/CloudFlare-API#docs)

Also, you can change your current EMAIL/TOKEN/HOST\_KEY values at any time without re-creating the object:

```
$cf_api_client->setEmail($email);
$cf_api_client->setToken($token);
$cf_api_client->setHostKey($host_key);

```

Installation
------------

[](#installation)

You can install `cloudflare-api` via [Composer](http://getcomposer.org/):

```
composer require okwinza/cloudflare-api

```

Or by simple `require`.

Support
-------

[](#support)

vk: [okwinza](https://vk.com/okwinza)
email:

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 93.3% 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 ~18 days

Total

5

Last Release

3869d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/44eb7fbb07158dc6922a997024aa10024bf20b7d340d8a69ee4ba0e0f0323afa?d=identicon)[okwinza](/maintainers/okwinza)

---

Top Contributors

[![okwinza](https://avatars.githubusercontent.com/u/108925?v=4)](https://github.com/okwinza "okwinza (28 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (2 commits)")

---

Tags

phpapirestcloudflare

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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