PHPackages                             hryha/do-cf-sync - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. hryha/do-cf-sync

ActiveProject[Utility &amp; Helpers](/categories/utility)

hryha/do-cf-sync
================

Sync Cloudflare IP ranges into a DigitalOcean Firewall (ingress rules)

1.0.0(5mo ago)11MITPHPPHP &gt;=8.2

Since Dec 17Pushed 5mo agoCompare

[ Source](https://github.com/vaniok010/do-cf-sync)[ Packagist](https://packagist.org/packages/hryha/do-cf-sync)[ Docs](https://github.com/vaniok010/do-cf-sync)[ RSS](/packages/hryha-do-cf-sync/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (3)Used By (0)

DigitalOcean Firewall sync with Cloudflare IPs
==============================================

[](#digitalocean-firewall-sync-with-cloudflare-ips)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0a9a657ffce7c0f594d06151968a91fcb1056fc37255c19bc197d1cc67b4bb29/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f68727968612f646f2d63662d73796e632e737667)](https://packagist.org/packages/hryha/do-cf-sync)[![PHP Version](https://camo.githubusercontent.com/e3762a283133756dd365d8fd65ff0edc7b377116f08870deea6cf2c1c90d72b8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d726564)](https://www.php.net/)[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE.md)

This small PHP utility syncs the current list of Cloudflare IP ranges into a specified DigitalOcean Firewall as inbound rules. It runs as a CLI script and is intended to be scheduled daily via cron.

What it does
------------

[](#what-it-does)

- Fetches Cloudflare IP ranges (both IPv4 and IPv6) from the official Cloudflare API.
- Updates the target DigitalOcean Firewall to allow inbound TCP traffic on configured ports (default: 80 and 443) from those Cloudflare ranges.
- Preserves your other firewall rules. It only replaces previously-added Cloudflare rules for the same ports.

Requirements
------------

[](#requirements)

- PHP 8.2+
- Composer
- A DigitalOcean Personal Access Token with write access to Firewalls
- An existing DigitalOcean Firewall ID you want to update

Installation
------------

[](#installation)

1. Clone or copy this repository to your server.
2. Install dependencies: ```
    composer install --no-dev --optimize-autoloader
    ```
3. Configure environment variables. Copy `.env.example` to `.env` and fill values: ```
    DO_TOKEN="your_digitalocean_api_token_here"
    DO_FIREWALL_ID="your_firewall_id_here"
    # Optional: comma-separated list of TCP ports to allow from Cloudflare
    PORTS="80,443"
    # Optional: add extra CIDRs (IPv4/IPv6) to allow in addition to Cloudflare ranges
    EXTRA_CIDRS="8.8.8.8/32,2001:db8::/32"
    ```
4. Add a daily cron job (every day at 02:15): ```
    15 2 * * * /usr/bin/php /path/to/project/bin/sync.php >> /var/log/do-cf-sync.log 2>&1
    ```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance73

Regular maintenance activity

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

152d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5106a78f875ddeafb9a6a976d4b4cd19e7570ca689b3450e37f88b6c8fde2a73?d=identicon)[vaniok010](/maintainers/vaniok010)

---

Top Contributors

[![vaniok010](https://avatars.githubusercontent.com/u/6134702?v=4)](https://github.com/vaniok010 "vaniok010 (1 commits)")

---

Tags

cloudflareDigitalOcean Firewall

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/hryha-do-cf-sync/health.svg)

```
[![Health](https://phpackages.com/badges/hryha-do-cf-sync/health.svg)](https://phpackages.com/packages/hryha-do-cf-sync)
```

###  Alternatives

[monicahq/laravel-cloudflare

Add Cloudflare ip addresses to trusted proxies for Laravel.

3372.7M4](/packages/monicahq-laravel-cloudflare)[blair2004/nexopos

The Free Modern Point Of Sale System build with Laravel, TailwindCSS and Vue.js.

1.2k2.3k](/packages/blair2004-nexopos)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[cloudflare/cf-ip-rewrite

Library to rewrite CloudFlare IP Addresses to the end-user IP address

15752.7k5](/packages/cloudflare-cf-ip-rewrite)[orrison/cumulus

Import DNS records from Laravel Vapor into Cloudflare

3817.1k](/packages/orrison-cumulus)[molayli/laravel-cloudflare-real-ip

Get the real ip for laravel applications behind cloudflare's reverse proxy

1221.0k](/packages/molayli-laravel-cloudflare-real-ip)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
