2017 © Pedro Peláez
 

library cloudflare-wp-api

WordPress HTTP API replacement of the jamesryanbell/cloudflare package.

image

typisttech/cloudflare-wp-api

WordPress HTTP API replacement of the jamesryanbell/cloudflare package.

  • Thursday, October 19, 2017
  • by TangRufus
  • Repository
  • 1 Watchers
  • 0 Stars
  • 12,715 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 7 Versions
  • 9 % Grown

The README.md

Cloudflare WP API

Latest Stable Version Total Downloads Build Status codecov Scrutinizer Code Quality PHP Versions Tested StyleCI Dependency Status License Donate via PayPal Hire Typist Tech, (*1)

WordPress HTTP API replacement of the jamesryanbell/cloudflare package., (*2)

, (*3)

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 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., (*4)

Install

Installation should be done via composer, details of how to install composer can be found at https://getcomposer.org/., (*5)

``` bash $ composer require typisttech/cloudflare-wp-api, (*6)


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 ``` bash $ 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:, (*7)

``` json "scripts": { "post-install-cmd": "cfwp build", "post-update-cmd": "cfwp build" }, (*8)



## 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 Decode **body** array from ``wp_remote_request``. ### Error responses ``WP_Error`` object. Maybe returned from ``wp_remote_request``, or one of the followings: | Code | Message | Data | |:--------------------- |:--------------------------------------------- |:--------- | | authentication-error | Authentication information must be provided | | | authentication-error | Email is not valid | | | decode-error | Response errors is not an array | response | Or, one of the Coudlfare defined error codes, here is some example: | Code | Message | Data | |:----- |:--------------------------------------------------------- |:--------- | | 1012 | Request must contain one of 'purge_everything' or 'files' | response | | 1210 | That operation is no longer allowed for that domain | response | ## Start Developing This command will clone the project source code from GitHub and install its dependencies. ``` bash $ composer create-project --no-install --prefer-source --keep-vcs typisttech/cloudflare-wp-api:dev-master $ cd cloudflare-wp-api $ composer install

Running the Tests

Cloudflare WP API run tests on Codeception and relies wp-browser to provide WordPress integration. Before testing, you have to install WordPress locally and add a codeception.yml file. See codeception.example.yml for a Varying Vagrant Vagrants configuration example., (*9)

Actually run the tests:, (*10)

bash $ composer test, (*11)

We also test all PHP files against PSR-2: Coding Style Guide and part of the WordPress coding standard., (*12)

Check the code style with $ composer check-style and fix it with $ composer fix-style., (*13)

Feedback

Please provide feedback! We want to make this library useful in as many projects as possible. Please submit an issue and point out what you do and don't like, or fork the project and make suggestions. No issue is too small., (*14)

Change log

Please see CHANGELOG for more information on what has changed recently., (*15)

Security

If you discover any security related issues, please email cloudflare-wp-api@typist.tech instead of using the issue tracker., (*16)

Contributing

Please see CONTRIBUTING and CONDUCT for details., (*17)

Credits

Cloudflare WP API is a Typist Tech project and maintained by Tang Rufus, freelance developer for hire., (*18)

Full list of contributors can be found here., (*19)

Special thanks to James Bell whose Cloudflare package make this project possible., (*20)

License

Cloudflare WP API is licensed under the GPLv2 (or later) from the Free Software Foundation. Please see License File for more information., (*21)

The Versions

19/10 2017

dev-master

9999999-dev https://github.com/TypistTech/cloudflare-wp-api

WordPress HTTP API replacement of the jamesryanbell/cloudflare package.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

wordpress api cloudflare typisttech cloudflare-wp-api

06/04 2017

dev-typisttech-config

dev-typisttech-config https://github.com/TypistTech/cloudflare-wp-api

WordPress HTTP API replacement of the jamesryanbell/cloudflare package.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

wordpress api cloudflare

02/03 2017

0.3.0

0.3.0.0 https://github.com/TypistTech/cloudflare-wp-api

WordPress HTTP API replacement of the jamesryanbell/cloudflare package.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

wordpress cloudflare typisttech cloudflare-wp-api

02/03 2017

0.2.0

0.2.0.0 https://github.com/TypistTech/cloudflare-wp-api

WordPress HTTP API wrapper around the jamesryanbell/cloudflare package.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

wordpress cloudflare typisttech cloudflare-wp-api

27/02 2017

0.1.2

0.1.2.0 https://github.com/TypistTech/cloudflare-wp-api

WordPress HTTP API wrapper around the jamesryanbell/cloudflare package.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

wordpress cloudflare typisttech cloudflare-wp-api

25/02 2017

0.1.1

0.1.1.0 https://github.com/TypistTech/cloudflare-wp-api

WordPress HTTP API wrapper around the jamesryanbell/cloudflare package.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

wordpress cloudflare typisttech cloudflare-wp-api

25/02 2017

0.1.0

0.1.0.0 https://github.com/TypistTech/cloudflare-wp-api

WordPress HTTP API wrapper around the jamesryanbell/cloudflare package.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

wordpress cloudflare typisttech cloudflare-wp-api