d8-contrib-modules / cloudflarephpsdk Goto Github PK
View Code? Open in Web Editor NEWPHP SDK For interfacing with CloudFlare's API
PHP SDK For interfacing with CloudFlare's API
The original implementation was built using guzzle5. With D8 beta13 the default version of guzzle became guzzle6. This broke a lot.
Endpoint is
"zones/{$zone['id']}/settings/waf"
Currently there is a rudimentary set of PHPUnit tests. There were written by a first time PHP unit noob. There is ample opportunity for improvement. Goal is to reach 100% test coverage. We want high coverage but also meaningful coverage. So tests that don't just simply result in the code being executed but that tests the outputs as much as possible.
The PHP SDK attempts to consolidate as much exception handling into a central location here:
https://github.com/d8-contrib-modules/cloudflarephpsdk/blob/master/src/ApiEndpoints/CloudFlareAPI.php#L123
The code is designed to throw typed exceptions when a problem happens and expects the implementing code to handle these exceptions:
https://github.com/d8-contrib-modules/cloudflarephpsdk/tree/master/src/Exceptions
Cloudflare JUST rolled out purging with cache tags. Should be a quick and easy addition.
https://support.cloudflare.com/hc/en-us/articles/206596608-How-to-Purge-Cache-Using-Cache-Tags
Different endpoints have different rate limits. We should account for this somehow.
I have the need to increase the per_page
limit to be 1000, to which decreases by application's report time significantly.
Currently the method listZones
does not allow overriding this value, and the other more raw method makeListingRequest
is protected.
per_page
is allowed to be set by the application, and not the library.
The library should not set the parameter for any other request type apart from GET.
Following along with the examples in the README.md file, the loadZone
method no longer exists.
$zone = $api->loadZone($zoneId);
$zone_settings = $zone-> getSettings();
Seems like getSettings
is directly on the ZoneApi
class:
$zone_settings = $api->getZoneSettings($zoneId);
[ ] As a maintainer of the SDK I want to ensure that the code has sufficient test coverage.
[ ] Add a test to the travis ci builds that runs the php unit tests with coverage and fails the build if code coverage drops below 80%.
[ ] Provide meaningful output to the user if the build fails due to insufficient code coverage.
I'm getting errors from the Cloudflare purger at times due to the client set timeout. I've verified API limits have not been breached but instead this is simply because Cloudflare had not responded in a timely manor.
Reported Error:
purger_cloudflare_055f11ff77: cURL error 28: Operation timed out after 3000 milliseconds with 0 bytes received (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
Whats unclear to me, is why, even after three seconds waiting for a response, no purging takes place. My default thought would be to extend the timeout to see if cloudflare timeouts to the API reduce.
I'm not familiar with phing. I wonder if it makes sense to swap out the current tools with Drupal TI, https://github.com/LionsAd/drupal_ti.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.