typisttech/cloudflare-wp-api
最新稳定版本:0.3.0
Composer 安装命令:
composer require typisttech/cloudflare-wp-api
包简介
WordPress HTTP API replacement of the jamesryanbell/cloudflare package.
README 文档
README
WordPress HTTP API replacement of the jamesryanbell/cloudflare package.
- Why use
WP HTTP APIinstead ofcurl? - Install
- Usage
- Start Developing
- Running the Tests
- Feedback
- Change log
- Contributing
- Security
- Credits
- License
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.
Install
Installation should be done via composer, details of how to install composer can be found at https://getcomposer.org/.
$ composer require typisttech/cloudflare-wp-api
Since the 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 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
Once $ cfwp build is done, you can use it exactly the same as the original package.
See 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.
$ 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.
Actually run the tests:
$ composer test
We also test all PHP files against PSR-2: Coding Style Guide and part of the WordPress coding standard.
Check the code style with $ composer check-style and fix it with $ composer fix-style.
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.
Change log
Please see CHANGELOG for more information on what has changed recently.
Security
If you discover any security related issues, please email cloudflare-wp-api@typist.tech instead of using the issue tracker.
Contributing
Please see CONTRIBUTING and CONDUCT for details.
Credits
Cloudflare WP API is a Typist Tech project and maintained by Tang Rufus, freelance developer for hire.
Full list of contributors can be found here.
Special thanks to James Bell whose Cloudflare package make this project possible.
License
Cloudflare WP API is licensed under the GPLv2 (or later) from the Free Software Foundation. Please see License File for more information.
typisttech/cloudflare-wp-api 适用场景与选型建议
typisttech/cloudflare-wp-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24.66k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2017 年 02 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「wordpress」 「cloudflare」 「typisttech」 「cloudflare-wp-api」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 typisttech/cloudflare-wp-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 typisttech/cloudflare-wp-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 typisttech/cloudflare-wp-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Symfony bundle for Cloudflare integration: trusted proxies, real client IP detection, forwarded headers.
Cloudflare Middleware For Guzzle
Library for helping bypass the Cloudflare IUAM page
A ZF2 plugin to fix global variables when using CloudFlare
Boost the performance of your site with Cloudflare or Varnish.
Must-use plugin integrating WordPress with the Upsun platform: environment awareness, router-cache friendliness, safe preview clones, deploy migrations, Site Health checks, and a wp upsun CLI command.
统计信息
- 总下载量: 24.66k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 15
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0
- 更新时间: 2017-02-25