PHP code example of tomaszaruba / cloudflare-api-nette
1. Go to this page and download the library: Download tomaszaruba/cloudflare-api-nette library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tomaszaruba / cloudflare-api-nette example snippets
use TomasZaruba\Cloudflare\Nette\Api;
use Cloudflare\Zone\Cache;
class ExampleClass
{
public function __construct(Api $cloudflareApi, Cache $cloudflareCache){
$this->cloudflareApi = $cloudflareApi;
$this->cloudflareCache = $cloudflareCache; // cache autoloads if there is defaultCache: true in config.neon
}
public function exampleCloudflare() {
$dns = new Cloudflare\Zone\Dns($this->cloudflareApi);
$dns->create('12345678901234567890', 'A', 'name.com', '127.0.0.1', 120);
$this->cloudflareCache->purge_files(
$this->cloudflareApi->getParameter('identifier'),
array($files)
);
}
}