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

Psr7 Cookies Laravel Package

hansott/psr7-cookies

Add and manage HTTP cookies on PSR-7 responses with a simple SetCookie helper. Create custom cookies, delete cookies, set long-lived cookies, or set cookies that expire at a specific time, then attach them to any Psr\Http\Message\ResponseInterface.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Feature Development: Enables seamless integration of HTTP cookies into PSR-7 request/response objects, simplifying cookie handling in APIs, microservices, or serverless architectures (e.g., Laravel-based APIs, middleware, or event-driven workflows).
  • Roadmap Alignment: Accelerates compliance with PSR-7 standards for projects migrating to modern PHP frameworks or adopting PSR-compliant middleware (e.g., Slim, Lumen, or custom PSR-7-based stacks).
  • Build vs. Buy: Avoids reinventing cookie parsing/serialization logic, reducing technical debt for teams prioritizing PSR-7 compliance or interoperability with other PSR-7-compatible libraries (e.g., HTTP message signing, caching).
  • Use Cases:
    • Session Management: Lightweight cookie handling for stateless APIs or hybrid session storage.
    • Authentication: Secure cookie-based auth (e.g., JWT, CSRF tokens) without framework-specific abstractions.
    • Analytics/Tracking: Standardized cookie manipulation for third-party integrations (e.g., Google Analytics, A/B testing).
    • Legacy System Integration: Bridging older PHP apps to PSR-7-compliant middleware or cloud functions.

When to Consider This Package

  • Adopt if:
    • Your stack uses PSR-7 (e.g., custom middleware, Slim, Lumen, or PSR-15/17 integrations).
    • You need cookie-specific features not covered by framework defaults (e.g., fine-grained control over Set-Cookie headers, secure/HTTP-only flags, or custom serialization).
    • Building a microservice or serverless function requiring PSR-7 compliance and cookie support.
    • Your team lacks bandwidth to implement RFC 6265-compliant cookie parsing/serialization from scratch.
  • Look elsewhere if:
    • You’re using a full-stack framework (e.g., Laravel, Symfony) with built-in cookie helpers (this package is low-level).
    • Your primary need is session storage (consider symfony/http-foundation or laravel/session).
    • You require cookie encryption/signing (pair with defuse/php-encryption or paragonie/halite).
    • Your project is non-PSR-7 (e.g., traditional $_COOKIE/$_SERVER reliance).

How to Pitch It (Stakeholders)

For Executives: "This package lets us standardize cookie handling across our PSR-7-based APIs/microservices, reducing custom code and ensuring compliance with modern PHP practices. It’s a lightweight, MIT-licensed solution that integrates seamlessly with our existing middleware stack, cutting development time for features like auth tokens or analytics tracking. Think of it as ‘Laravel’s cookie system, but for PSR-7’—ideal if we’re expanding into serverless or microservices."

For Engineering: *"The hansott/psr7-cookies package provides a PSR-7-compliant way to manipulate cookies (e.g., Set-Cookie, parsing) without framework lock-in. Key benefits:

  • Interoperability: Works with any PSR-7 request/response object (e.g., Slim, custom PSR-15 middleware).
  • Security: Explicit control over Secure, HttpOnly, and SameSite flags (critical for GDPR/compliance).
  • Performance: Zero dependencies beyond PSR-7, lightweight for high-throughput systems.
  • Future-proof: Aligns with PHP-FIG standards, avoiding tech debt if we adopt PSR-15/17 later. Use case: Replace ad-hoc cookie logic in our API gateway with a standardized, testable layer. Pair with paragonie/halite for signed cookies if needed."*
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.
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode