PHP code example of qbcloud / laravel-cloudflare
1. Go to this page and download the library: Download qbcloud/laravel-cloudflare 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/ */
qbcloud / laravel-cloudflare example snippets
// config/cloudflare.php
return [
'email' => '[email protected] ', // Cloudflare Username
'global_key' => 'globalxxoo', // Cloudflare Global API Key
'account_id' => 'bbxxkk', // Cloudflare Account ID
'ip_address' => null // 默认记录值 用于添加DNS记录
];
use QbCloud\Cloudflare\Facades\Cloudflare;
// 批量创建站点
Cloudflare::createZones(['xxx.com','xxx.net']);
// 批量删除站点
Cloudflare::deleteZones(['xxx.com','xxx.net']);
// 清除站点所有缓存内容
Cloudflare::purgeAllCache('xxx.com');
// 批量添加DNS记录
Cloudflare::createRecords('xxx.com', ['@', 'www', 'test'], '127.0.0.1', 'A');
// 删除一条DNS记录
Cloudflare::deleteRecords('xxx.com', 'test');
// 删除所有DNS记录
Cloudflare::deleteAllRecords('xxx.com');
// 修改SSL类型
Cloudflare::updateSSLSetting('xxx.com', 'full');
// 或者
use QbCloud\Cloudflare\Cloudflare;
$cloudflare = new Cloudflare();
$cloudflare->createZones(['xxx.com','xxx.net']);
bash
php artisan vendor:publish --provider="QbCloud\Cloudflare\Providers\CloudflareServiceProvider"