nette/http
Nette HTTP provides a clean, lightweight HTTP layer for PHP apps. It handles requests, responses, headers, cookies, sessions, and URL utilities with a consistent API, making it easy to build frameworks, middleware, or standalone services.
RequestFactory::setForceHttps() and X-Forwarded-* handling to ensure correct protocol detection behind proxies (e.g., AWS ALB, Nginx).Url::parseQuery() and UrlImmutable for consistent, RFC-compliant URL manipulation (e.g., path normalization, query parameter handling).FileUpload::getSanitizedName() to mitigate risks like path traversal or malicious filenames in user uploads.HttpExtension for dynamic CSP policies, SameSite attributes, and cookie path/domain management to reduce cross-site scripting risks.RequestFactory’s port detection fixes and Session’s lazy initialization to reduce overhead in high-traffic APIs.getReferer(), getRemoteHost()) to avoid technical debt.Url::resolve() and UrlImmutable to handle region-specific URLs (e.g., https://{region}.example.com) dynamically.Avoid if:
Illuminate\Http\Request/Response without custom extensions (low incremental value).nette/di) may outweigh benefits.Consider if:
X-Forwarded-* handling."This package standardizes how our Laravel apps handle HTTP requests, responses, and sessions—reducing security risks (e.g., cross-site scripting) and improving performance behind proxies. It’s like upgrading from a manual car to an autonomous one for HTTP traffic: fewer bugs, better compliance, and easier scaling. For example, it automatically fixes issues with HTTPS detection behind load balancers (a common pain point in our cloud deployments) and enforces secure cookie policies by default. The cost? Minimal—it’s a drop-in replacement for Laravel’s native HTTP tools, with a one-time integration effort. ROI comes from fewer security incidents and smoother deployments."
*"nette/http gives us a battle-tested, RFC-compliant HTTP abstraction layer that:
X-Forwarded-* headers and forces HTTPS behind load balancers (e.g., RequestFactory::setForceHttps()).Session::autoStart()).UrlImmutable for path normalization, query parsing, and IDN (international domain) support.nette/di) or standalone. Example: Swap Request::getReferer() with Request::getOrigin() for RFC 6454 compliance.Trade-offs:
getRemoteHost() → getRemoteAddress()) over time.Quick win: Start with FileUpload for sanitization and RequestFactory for proxy support—both solve immediate pain points with minimal refactoring."*
How can I help you explore Laravel packages today?