Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Symfony Cloudflare Multi View Laravel Package

michallkanak/symfony-cloudflare-multi-view

Symfony bundle for Cloudflare multi-view setups: configure multiple views in one place and serve the right one per request. It streamlines Cloudflare integration with Symfony services and Twig, keeping view selection clean, configurable, and easy to maintain.

View on GitHub
Deep Wiki
Context7

Getting Started

The package is a Symfony bundle that renders a password-protected dashboard over Cloudflare's analytics API for multiple zones/accounts. Your first day with it looks like this:

  1. Confirm the framework match before installing. It is a Symfony bundle (Bundle class, DI Extension/Configuration, Twig templates). If your app is Laravel, there is no service provider and no publishable config — you will either bridge it manually (register the bundle's services in a provider, swap Twig for Blade) or lift the Cloudflare client and skip the UI entirely. Check the PHP constraint against your runtime before you composer require.
  2. Read the source, not the README. The public docs are a paragraph; the release history is one colour fix (0.1.1). The real configuration surface lives in DependencyInjection/Configuration.php and the template resources. Read both before wiring anything.
  3. Provision a read-only Cloudflare API token. Analytics:Read is enough for the dashboard; do not hand it zone-edit scope. Note the account ID and the zone IDs you want to show.
  4. Configure accounts, zones, and dashboard auth. Register the bundle, supply one or more Cloudflare credentials/account contexts (that's the "multi-view" part), and set the dashboard password. Then load the dashboard route on staging.
  5. First real use case: stand the dashboard up for two Cloudflare accounts so you validate the multi-context config — that's the reason to use this bundle over a single-zone script, and it is where misconfiguration shows up first. Add a group (e.g. "Marketing sites") and confirm zones appear under it.

If step 4 is fighting you, stop and check whether the core client is usable standalone — the dashboard is the least portable part, and that decision is cheaper to make on day one than week three.

Implementation Patterns

  • Treat the package as an internal ops tool, not a customer feature. The realistic day-to-day is: a handful of engineers/admins hit the dashboard to see traffic and country/trend data per domain. Route it behind your existing auth or an internal-only host, and don't wire it into anything customer-facing.
  • Model your groups in config, not code. The group-based organisation is the primary ergonomic win for multi-domain setups — commit a config file mapping accounts → zones → groups (by client, environment, product line). That file becomes the readable inventory of "what we monitor", and onboarding a new domain is a config diff, not a code change.
  • Add a caching layer yourself. The bundle queries Cloudflare analytics; those endpoints are rate-limited and latency-bound. Put a short-TTL cache in front (a few minutes for "real-time", longer for daily/hourly trends) keyed on account+zone+range. Without it, a dashboard left open on a big screen will generate a steady stream of requests and eventually 429.
  • Wrap the integration behind your own interface. Even if you use the bundle as-is, expose a thin service of your own (get zones, get traffic series, get country breakdown) that delegates to the bundle's services. When 0.2 lands — and at 0.1.x it will — you patch one file, not your controllers and templates.
  • Keep the credential layer environment-aware. Per the package's stated design, credentials are configurable per environment/view. Put test and prod Cloudflare tokens in separate env contexts so a staging dashboard can never display (or rate-limit) production data.
  • Diff and pin on upgrade. Use "0.1.*" at most, exact-pin if you're risk-averse, and read the tag diff before bumping — 0.1.1 is a colour-mapping change only, so upgrading from 0.1.0 needs a visual smoke test of the country lines and nothing more.
  • Log the dashboard's upstream failures explicitly. On 0.1.x, expect swallowed errors to render as empty charts. Add a log around your cache/client wrapper so "no data" is distinguishable from "API failed" in your observability tooling.

Gotchas and Tips

  • The 0.1.1 release tells you where the risk is. "Fix colors on country lines" is a purely presentational patch, authored by the maintainer, on a one-star single-contributor project. That means: the view layer is still stabilising, there is no BC policy, and there is effectively one person between you and breakage. Pin the version, vendor the code, and assume you own maintenance.
  • Never trust the dashboard's numbers as a source of truth for billing or SLAs. This is a visualisation over Cloudflare's analytics — those numbers are sampled and lagged. Use it for "is traffic up/down and where from", not for invoicing or contractual reporting.
  • Cache keys and Vary matter if you embed any of this. If you surface a per-country fragment anywhere in your own app, key your cache on country or you'll serve one country's view to everyone — the classic geo bug, and painful to spot because the page still renders.
  • Password protection is not your auth story. The built-in password gate is a convenience. Put the dashboard behind your existing SSO/VPN/internal network and treat the package's password as a second lock, not the lock.
  • Token handling is the top failure mode. A read-only token expiring or being revoked blanks the whole dashboard. Add a SECURITY.md-less-dependency mitigation: rotate tokens on a calendar, scope to analytics read, and include the dashboard in whatever health-checking you have. Consider a small /health/cloudflare-analytics probe that fails loudly.
  • Watch memory on wide views. Server-side rendering of many country time-series scales with zone count and query depth. Fine at 10–20 zones; if you're aggregating hundreds, expect slow responses and consider narrowing the default range or splitting into groups.
  • Extension point to prefer: a decorator over the package's country/data resolver, registered by your own service config. Do not fork, do not edit templates in vendor/ — both raise your rebase cost on every upstream tag.
  • Debugging tip for "empty dashboard": log the raw Cloudflare API response status and body on first deploy. It separates "bad config/token", "rate limited", and "bundle bug" in one glance, and at 0.1.x you will need that distinction quickly.
  • Reassess at 0.2 / 1.0. If a BC policy appears and the core decouples from Symfony/Twig, adoption gets materially cheaper. Until then, keep the integration behind your interface so swapping it for a few dozen lines against Cloudflare's analytics API remains an afternoon's work.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console