ghostcompiler/laravel-cloudflare 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ghostcompiler/laravel-cloudflare

Composer 安装命令:

composer require ghostcompiler/laravel-cloudflare

包简介

Production-ready Laravel SDK for the Cloudflare API v4

README 文档

README

Laravel Cloudflare

Laravel Cloudflare SDK

A premium, feature-rich PHP SDK and Laravel integration for the Cloudflare API v4, featuring rate-limit handling, automatic retries, and concurrent batch operations.

Laravel PHP Version Cloudflare API Ghost Compiler

Packagist Downloads GitHub Stars

Features

  • 100% Endpoint Coverage: Complete implementation of all zones, DNS, Workers, KV, R2, D1, Access, Turnstile, and 30 resource managers.
  • Fail-Safe Retries & Backoff: Robust exponential backoff and rate-limit parsing handling Retry-After response headers automatically.
  • Concurrently Pooled Processing: Execute calls asynchronously or concurrently in batches.
  • Dynamic Filter Builder: Fluent query-building for filtering, page indexing, and sorting.
  • Type-Safe DTOs: Automated data hydration into standard PHP DTO structures.
  • Custom Exceptions: Specialized mapping of Cloudflare API status codes and error formats.

Installation

Install the package via Composer:

composer require ghostcompiler/laravel-cloudflare

Publish the configuration file:

php artisan vendor:publish --provider="Vendor\Cloudflare\Providers\CloudflareServiceProvider" --tag="config"

Add your Cloudflare credentials to your .env file:

CLOUDFLARE_TOKEN=your_api_token_here
# Or legacy email/key credentials
CLOUDFLARE_EMAIL=your_email_here
CLOUDFLARE_API_KEY=your_global_api_key_here

CLOUDFLARE_TIMEOUT=30
CLOUDFLARE_RETRIES=3
CLOUDFLARE_RETRY_BACKOFF=100
CLOUDFLARE_LOGGING_ENABLED=true

Usage Examples

Zones

Listing Zones

use Vendor\Cloudflare\Facades\Cloudflare;

$zones = Cloudflare::zones()
    ->filter(['status' => 'active'])
    ->perPage(50)
    ->page(1)
    ->get();

foreach ($zones as $zone) {
    echo $zone->name . ': ' . $zone->status . "\n";
}

DNS Records

Managing DNS Records for a Zone

// Create a new record
$record = Cloudflare::dns()->create('zone_id_here', [
    'type' => 'A',
    'name' => 'subdomain',
    'content' => '1.2.3.4',
    'proxied' => true,
    'ttl' => 1
]);

// Update the record
Cloudflare::dns()->update('zone_id_here', $record->id, [
    'type' => 'A',
    'name' => 'subdomain',
    'content' => '5.6.7.8',
    'proxied' => false,
    'ttl' => 120
]);

// Delete the record
Cloudflare::dns()->delete('zone_id_here', $record->id);

Worker Scripts

Uploading and Managing Workers

Cloudflare::workers()->upload('account_id_here', 'my-script', 'console.log("Hello Worker");');

License

The MIT License (MIT). Please see License File for more information.

Development Environment

Built using ServBay

ServBay

  • Mac M4 Tested
  • macOS Apple Silicon
  • Powered by ServBay

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固