承接 nawasara/cloudflare 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

nawasara/cloudflare

Composer 安装命令:

composer require nawasara/cloudflare

包简介

Cloudflare management dashboard for Nawasara — DNS records, zones, firewall rules, page rules, SSL settings, and analytics, with DB-cached snapshots and queue-backed mutations.

README 文档

README

Cloudflare management dashboard for the Nawasara superapp framework — DNS records, zones, firewall rules, page rules, SSL settings, cache, and analytics, all read from a local DB snapshot for speed and mutated through queue jobs for auditability.

Features

  • Zone management — list domains with SSL mode, security level, plan, name servers, and per-zone settings
  • DNS records — full CRUD across A, AAAA, CNAME, MX, TXT, NS, and SRV types, with comment + tags preserved on update
  • Firewall rules — CRUD WAF custom rules per zone
  • Page rules — CRUD URL-pattern rules
  • Analytics — request volume, bandwidth, threats blocked, and unique visitors with per-OPD rollup
  • Cache purge — purge entire cache or specific URLs
  • Under Attack mode — toggle the security level when a zone is under DDoS pressure
  • Sync info bar on every page showing the last successful sync time, pending mutation count, and a link to the audit log

The package follows the DB-cache + queue pattern from nawasara/sync: reads come from local snapshot tables (paginated, fast); writes dispatch queue jobs that update Cloudflare and the snapshot via content-hash conflict detection.

Installation

composer require nawasara/cloudflare
php artisan migrate
php artisan db:seed --class="Nawasara\Cloudflare\Database\Seeders\PermissionSeeder" --force

The package is auto-discovered by Laravel — no manual provider registration required.

Cloudflare API Token Setup

1. Sign in to the Cloudflare dashboard

Go to dash.cloudflare.com and sign in to the account that manages your domains.

2. Open the API Tokens page

Click your profile icon (top right) → My ProfileAPI Tokens tab.

3. Create a custom token

Click Create Token → choose Create Custom Token at the bottom of the templates list.

4. Configure permissions

Name the token (e.g. Nawasara Dashboard) and add the following permissions depending on which features you plan to use:

Permission Access Used for
Zone → Zone Read List zones, zone detail
Zone → Zone Settings Edit SSL mode, security level, Under Attack mode
Zone → DNS Edit CRUD DNS records
Zone → Firewall Services Edit CRUD firewall rules
Zone → Analytics Read Dashboard analytics
Zone → Cache Purge Purge Cache purge (all / per URL)

Edit permission already implies Read, so there's no need to add Read separately for DNS, Firewall, or Zone Settings.

5. Zone Resources

Choose the scope:

  • All zones — the token can access every domain in the account
  • Specific zone — restrict to one or a few domains (recommended if you only manage a subset)

6. (Optional) IP Address Filtering

If your Nawasara server has a static IP, add Client IP Address FilteringIs in → enter the IP. This protects against the token being used from anywhere else if it leaks.

7. (Optional) Token lifetime

Set Start Date and End Date for a temporary token. Leave blank for a permanent one.

8. Create the token

Click Continue to summary, review, then Create Token.

Copy the displayed token immediately — Cloudflare only shows it once.

9. Note the Account ID

Find your Account ID:

  • Open any zone's Overview page
  • The Account ID is in the right sidebar under API

Or read it from any dashboard URL: dash.cloudflare.com/{ACCOUNT_ID}/...

Storing credentials in Vault

  1. Open Nawasara → /nawasara-vault
  2. Choose the Cloudflare group
  3. Fill in:
    • API Token — paste the token from step 8
    • Account ID — from step 9
  4. Save

The package picks up credentials from Vault automatically.

Verification

Open Cloudflare → Zones in the sidebar. Your domain list should appear after the first sync.

If it doesn't, check:

  • The token is pasted exactly (no leading or trailing whitespace)
  • Account ID matches the destination account
  • Token permissions include every feature you want to use
  • Zone Resources includes the domains you intend to manage

Permissions

Permission Description
cloudflare.zone.view View zone list
cloudflare.dns.view View DNS records
cloudflare.dns.create Create a DNS record
cloudflare.dns.edit Edit a DNS record
cloudflare.dns.delete Delete a DNS record
cloudflare.waf.view View firewall rules
cloudflare.waf.create Create a firewall rule
cloudflare.waf.edit Edit a firewall rule
cloudflare.waf.delete Delete a firewall rule
cloudflare.ssl.view View SSL status
cloudflare.ssl.manage Change SSL mode
cloudflare.analytics.view View analytics
cloudflare.cache.purge Purge cache
cloudflare.ddos.view View security level
cloudflare.ddos.manage Change security level / Under Attack mode

All permissions are auto-assigned to the developer role by the seeder.

Author

Pringgo J. Saputro <odyinggo@gmail.com>

License

MIT

nawasara/cloudflare 适用场景与选型建议

nawasara/cloudflare 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 131 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 05 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「analytics」 「firewall」 「cdn」 「dns」 「laravel」 「cloudflare」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 nawasara/cloudflare 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 nawasara/cloudflare 我们能提供哪些服务?
定制开发 / 二次开发

基于 nawasara/cloudflare 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-09