- How do I install pdphilip/cf-request in a Laravel application?
- Install the package with Composer using composer require pdphilip/cf-request. Laravel package discovery registers the service provider automatically. If the package ships configuration files, publish them with php artisan vendor:publish and adjust as needed. No additional infrastructure or runtime components are required.
- Which Laravel versions does pdphilip/cf-request support?
- Version 3.1.0 supports Laravel 11 and 12, and declares forward-looking support for Laravel 13. Laravel 10 support was dropped, so applications on L10 must stay on v3.0.x. The CI matrix tests PHP 8.3 and 8.4, so PHP 8.2 runtimes should be treated as unsupported even if Composer does not hard-block them.
- What Cloudflare data does cf-request add to the Laravel request?
- The package enriches the standard Laravel HTTP Request with Cloudflare-provided metadata. This includes the connecting IP, visitor country, Ray ID, timezone, and bot or threat information. It also exposes derived device type, operating system, and browser details, so you avoid manual header parsing.
- Do I need to run my Laravel app behind Cloudflare for cf-request to work?
- Yes. The package reads Cloudflare-specific request headers, so it only provides meaningful data when traffic passes through Cloudflare. For applications not behind Cloudflare, the package adds little practical value. It is best treated as a targeted integration for Cloudflare-fronted Laravel apps.
- How does cf-request detect the visitor's device, OS, and browser?
- It derives device type, operating system, and browser information from the incoming request headers, primarily the User-Agent. Those values are exposed alongside the Cloudflare metadata on the enriched request. This keeps user-agent parsing out of your controllers and middleware.
- What changed in cf-request v3.1.0?
- The v3.1.0 release expands Laravel version support, improves the CI and test harness, bumps a dependency floor, and includes an internal HTTP client correctness fix changing getBody()->getContents() to body(). The only behavioral touchpoint is that HTTP client fix, which aligns the package with Laravel's documented API. The larger breaking change is the deliberate removal of Laravel 10 support.
- Is cf-request still usable on Laravel 10?
- Laravel 10 is no longer supported in v3.1.0 and later. Applications still on Laravel 10 must pin to v3.0.x, which will not receive the HTTP client fix or future patches. Treat this as a forced migration path and plan the framework upgrade rather than a routine dependency bump.
- What dependencies does cf-request bring into my Laravel project?
- The package is a lightweight leaf dependency with no queue, daemon, or worker footprint. Its notable transitive dependency is pdphilip/omniterm ^3.0, which is a major-version floor bump. Review omniterm's own changelog, license, and PHP or Laravel constraints before upgrading.
- How should I test cf-request locally without Cloudflare headers?
- Locally, Cloudflare headers will not be present, so the package cannot resolve real edge data. In feature tests, construct requests with the relevant CF-* headers, such as CF-Connecting-IP, CF-IPCountry, and CF-Ray, to exercise the enrichment logic. Validate the full behavior in staging behind an actual Cloudflare-proxied environment.
- What are the production risks of using cf-request?
- The main risks are the hard Laravel 10 compatibility break, single-maintainer bus factor, and the major omniterm ^3.0 dependency bump. The blast radius is small because the package is a narrow wrapper with no infrastructure footprint. Pin versions, review transitive dependencies, and validate upgrades in staging before production.