Repository navigation
Getting started
This page documents the released 0.9.0 Cirrus package.
- Laravel 12 or 13.
- PHP 8.4.27+ within the 8.4 line, or PHP 8.5.12+ within the 8.5 line.
- The PHP filter and JSON extensions.
- A controlled ingress that establishes the provenance of Cloudflare headers.
Cloudflare must supply the desired headers. Enable IP Geolocation for country information and the Add visitor location headers Managed Transform for the additional location fields. The package reads those values; it does not enable the settings.
composer require moztopia/cloudflare:^0.9
php artisan vendor:publish --tag=cloudflare-configComposer discovery registers the provider and the Cloudflare facade alias. Applications that disable discovery must register Moztopia\Cloudflare\CloudflareServiceProvider themselves and import the fully qualified facade.
No migrations, queues, scheduled jobs, API credentials or HTTP client setup are required by the core.
The published config/cloudflare.php starts with an empty trusted_proxies list. Configure the immediate peer that reaches Laravel:
return [
'trusted_proxies' => [
'192.0.2.10',
'2001:db8::/48',
],
];These are documentation addresses, not real Cloudflare ranges. Replace them with the verified IP addresses or CIDRs for your own topology. Read Trusted ingress before choosing them. Wildcard trust is unsupported.
After changing a deployed application's configuration, clear or rebuild its configuration cache through its normal deployment procedure.
use Moztopia\Cloudflare\Facades\Cloudflare;
$visitor = Cloudflare::visitor();
$country = $visitor->countryCode;
$region = $visitor->region;
$timezone = $visitor->timezone;Every location property is nullable. Unknown values are expected on localhost, when a setting is missing, or when ingress is untrusted. Provide the application's usual fallback rather than guessing a location.
use Moztopia\Cloudflare\Cloudflare\Cloudflare as CloudflareContext;
final class DeliveryController
{
public function __invoke(CloudflareContext $cloudflare)
{
return view('delivery', [
'visitor' => $cloudflare->visitor(),
]);
}
}The consuming application owns its controller, route and delivery view. The package registers no delivery routes or business policies.
The current release uses the common Cloudflare alias, cloudflare configuration namespace and cloudflare-config publish tag. Other packages may use the same identifiers. Inspect their publishing destinations before publishing, preserve existing configuration and import this package's facade by its full class name in PHP. An explicit PHP import resolves the facade class; it does not eliminate a shared configuration-file collision.
A distinct, backward-compatible coexistence scheme is planned. It has not yet shipped.
See Blade and testing and Visitor and request context for more usage details.
Maintained by-dolly.
Released API reference: 0.9.0 — Cirrus. Future capabilities are marked on the Roadmap.
Repository · Project website · Apache-2.0
Maintained by-dolly.

Moztopia Cloudflare
- Home
- Getting started
- Trusted ingress
- Visitor and request context
- Diagnostics and doctor
- Blade and testing
- Example website
- Development and verification
- Branding
- SDK contract
- Roadmap
- Unreleased core work
- Release gates
- Optional credential-free additions
- V2 discovery
- Planning decisions
- Ecosystem review
- Ecosystem inventory
Maintained by-dolly.