PHP CloudflareProject Library
The PHP cloudflare library will used to create the following using cloudflare API :
- To create github repository.
- To push static site project on github repositories.
- To create a cloudflare static page project on cloudflare account.
- To deploy cloudflare static pages projects .
- To add domains on cloudflare accounts.
- To analyze the all function of zones/domains.
- source code : git clone https://github.com/shyambaseapp/ClodflareProject.git.
- update composer to install all dependency and library.
- command : composer update
Create .env file on project root directory.
githubOwner = ownerName
gitAuthKey =
path = PathToStaticSite
repoName = alpha
repoBranch = master
gitComment = comments
accountId =
xAuthEmail = example@gmail.com
xAuthKey =
projectName = xyz
domain = xyz.com
zoneId =
date_gt = 2022-01-04
date_lt = 2022-01-21
Store git credential on local computer :
1. store credentials to Git Credential Storage fallow the given link:
<?php
use DevCoder\DotEnv;
require_once __DIR__ . '/envClass.php';
require_once __DIR__ . '/cloudflareApiClass.php';
require_once __DIR__ . '/githubApiClass.php';
(new DotEnv(__DIR__ . '/.env'))->load();
$githubOwner = getenv('githubOwner');
$gitAuthKey = getenv('gitAuthKey');
$path = getenv('path');
$repoName = getenv('repoName');
$repoBranch = getenv('repoBranch');
$gitComment = getenv('gitComment');
$accountId = getenv('accountId');
$xAuthEmail = getenv('xAuthEmail');
$xAuthKey = getenv('xAuthKey');
$projectName = getenv('projectName');
$domain = getenv('domain');
$zoneId = getenv('zoneId');
$date_gt = getenv('date_gt');
$date_lt = getenv('date_lt');
$gh = new Github($githubOwner, $gitAuthKey, $repoName, $repoBranch, $gitComment);
$cf = new CloudFlare($githubOwner, $gitAuthKey, $repoName, $repoBranch, $gitComment, $xAuthEmail, $xAuthKey, $domain, $accountId, $projectName);
$gh->gitCreateRepo();
$gh->gitRepoPushCode($path);
$cf->createCloudFlarePages();
$cf->deployCloudFlarePages();
$cf->addCloudFlareDomain();
$cf->zoneAnalytics($zoneId, $limit, $date_gt, $date_lt);
?>