Repository navigation
SDK contract
Moztopia Cloudflare is one Laravel package, moztopia/cloudflare. Its public SDK should feel coherent, uniform, structured and natural to use. Contract design comes before implementation of an extension.
This page distinguishes the released API from design principles for future work. It does not introduce additional methods.
The wiki is the source of truth for project human-facing documentation. Keep detailed usage, configuration, examples, contributor guidance and roadmap decisions here. The root README introduces the package and links here; folder READMEs provide local context and quick entry points. Preserve agent operational instructions in their existing source locations. Version records, changelogs, license text and implementation/tests remain canonical source artifacts; link to them rather than maintaining competing copies. Update the relevant wiki pages when a public contract changes.
Cirrus is the persistent release name through and including 1.0.0. Keep the numeric source version in VERSION and the name in RELEASE_NAME. Version advances and branch promotions preserve Cirrus; a later name requires a separate explicit owner decision. The Roadmap lists the planned versions.
Cloudflare::visitor() returns an immutable Visitor snapshot. Cloudflare::requestContext() returns an immutable RequestContext snapshot. The injectable Moztopia\Cloudflare\Cloudflare\Cloudflare service exposes the same reads.
Reads resolve the active request, retain no per-visitor state in the service and make no network requests. Missing, malformed or untrusted metadata remains unknown. trusted records acceptance of the configured immediate peer and is not visitor authentication.
The configuration key is currently cloudflare.trusted_proxies; discovery advertises the Cloudflare alias. These existing identifiers are part of the compatibility assessment for future coexistence work.
The field reference and tagged source define the shipped behavior.
The service class is final. In 0.9.0, direct facade mocking with shouldReceive() cannot replace it. Application tests can pass immutable snapshots to views or use synthetic requests through the real service. A dedicated testability contract is planned; see Blade and testing.
All capabilities required for 1.0.0 remain credential-free. Installation, discovery, resolution and ordinary visitor/request-context reads need no API token, service secret or signing secret and perform no outbound requests. Public identifiers and public keys are configuration, not secret credentials; browser requests, public-data downloads and key refresh still require explicit scope/configuration and privacy/failure handling. They must not become hidden context-read effects.
Postal codes and postal-code enrichment are excluded from the initial 1.x requirements; no postalCode property, GeoLookup dependency or later release target is promised.
Proposed future responsibility groups are context snapshots, diagnostics, local image builders and response policies. These are design boundaries, not new shipped methods. Each feature must present intended controller/service/DI/facade/Blade/test usage, naming, typed results, unknowns, effects and configuration precedence before implementation. Compatible identifiers/publishing come first in #19; the chosen consumer-test seam in #9 retains its owner review gate.
V2.x discovery may recommend optional authenticated modules in the same Laravel package. Their configuration/credential resolution must be lazy and feature-specific: installing the package and using the credential-free core must keep working without tokens or remote calls. Use explicit effectful operations, scoped account/zone/resource selection, Laravel-native fakeable transport where appropriate, structured failures and bounded idempotency-aware retries. R2 keys, Turnstile secrets and image signing keys are not interchangeable with account API tokens.
No v2 method, dependency split, selected module bundle or later codename is approved by the planning records. Review the V2 discovery assessments and #50 before implementation. Keep current public methods/configuration compatible and document any future migration/deprecation deliberately. Cirrus remains through and including 1.0.0.
The Release gates define required evidence. The Roadmap, Optional credential-free additions, Ecosystem review and Planning decisions distinguish committed scope, optional candidates, source rationale and unresolved owner choices.
- Start with consumer usage. Write examples for controllers, services, Blade and tests before finalizing a public feature. Review whether each call is understandable without knowing the implementation.
- Use consistent naming and grouping. Give each feature a clear responsibility. Keep naming, option conventions and return patterns consistent across related operations. Prefer a small discoverable surface over aliases for every possible spelling.
- Use explicit, typed results. Preserve immutable request snapshots and predictable unknown-value semantics. Do not replace unknown geography with empty strings, invented defaults or a misleading false value.
- Make effects visible. Reading context stays network-free. Any future download or refresh must be explicitly invoked and distinguishable from a local read or URL builder. Installation and resolution must not silently administer Cloudflare resources.
- Keep configuration deliberate. Avoid hidden precedence, broad automatic trust or overwriting Laravel behavior. Document default values, validation, cache interaction and the relationship to the host application's own configuration.
- Keep Laravel usage natural. Support dependency injection, facades, Blade and ordinary Laravel tests consistently. Keep optional capabilities optional; do not require databases, credentials or background services for the small core.
- Preserve compatibility thoughtfully. Review names, configuration and documented workflows as public contracts. Preserve working supported usage or provide a deliberate deprecation/migration path. Assess versions by actual impact, not by the fact that the project is pre-1.0.
- Keep documentation executable in spirit. Examples must use real shipped methods. Mark proposals clearly and test implementation behavior rather than merely duplicating examples' strings.
- Can a consuming developer explain the call and result from its name?
- Does it use the same terminology and conventions as neighboring features?
- What happens when metadata is missing, invalid or untrusted?
- Does it require a secret, perform I/O or change the host application?
- How is it used and isolated in application tests?
- Can it coexist with another Cloudflare package without ambiguous bindings or publishing?
- Does the example application demonstrate both success and fallback behavior?
- Are configuration, support requirements and compatibility implications explicit?
A feature is not ready merely because its underlying Cloudflare endpoint can be called. The consumer contract, failure behavior, tests and documentation must fit the whole SDK.
The committed direction through 1.0 is credential-free application functionality. Account/DNS administration, authenticated purge APIs, remote WAF synchronization, tunnel lifecycle management and secret-backed service drivers are outside the required 1.0 scope; selected optional authenticated work is only being evaluated in the separate v2.x discovery backlog.
Some integrations can use public identifiers or public verification keys without an API secret. They still need individual design review: Access identity verification, for example, introduces authentication responsibilities beyond reading visitor context.
See the Roadmap for sequencing. Feature count is not the measure of quality; usability and consistency are.
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.