biozahard / yii2-cloudflare-api
Simple Yii2 cloudflare extension without any requirements.
Installs: 26
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 2
Open Issues: 0
Type:yii2-extension
Requires
- php: >=5.3.0
- yiisoft/yii2: *
Requires (Dev)
This package is not auto-updated.
Last update: 2025-03-02 05:03:16 UTC
README
Yii2 Component for CloudFlare api v4.0. https://www.cloudflare.com/
Minimum requirements: Yii2, Curl
Installation via Composer:
composer require biozahard/yii2-cloudflare-api
Configuring in config.php:
'components' => [ //... 'cloudflare' => [ 'class' => 'biozahard\cloudflare\CloudflareApi', 'apiurl' => 'https://api.cloudflare.com/client/v4/', 'authkey' => '5gds0kfdsc024ndsofsj049jisdofjsd034jw', 'authemail' => 'admin@mail.com', 'sites' => [ 'mysite.com', 'thebest-country.ua', 'anotheronesite.biz', ], ], //... ]
After this configuring you can use: \Yii::$app->cloudflare
So, let's see some examples:
- Purge all cloudflare cache:
//get the CloudFlare api component
$cf = \Yii::$app->cloudflare;
//purge cache for specific website:
$cf->purgeCache('thebest-country.ua');
//Clear the cache for the first site from the specified list:
$cf->purgeCache();
License: LGPL v3 or later