qbcloud / laravel-cloudflare
A Laravel extension package for managing Cloudflare websites and domain names.
1.0.0
2024-07-01 05:49 UTC
Requires
- php: >=7.2.5
- ext-json: *
- cloudflare/sdk: ^1.3
- illuminate/support: ^5.2|^6|^7|^8
This package is auto-updated.
Last update: 2025-03-29 01:08:49 UTC
README
使用Laravel 6.x 以上在Cloudflare上批量创建站点、批量删除站点、批量添加DNS记录、快速删除所有DNS记录、修改SSL类型、清除站点所有缓存内容。
用法
composer require qbcloud/laravel-cloudflare
发布配置文件:
php artisan vendor:publish --provider="QbCloud\Cloudflare\Providers\CloudflareServiceProvider"
// config/cloudflare.php return [ 'email' => 'xxx@gmail.com', // 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']);