Skip to content

Conversation

tups
Copy link

@tups tups commented Aug 17, 2024

Add advanced cookie configuration to I18n class

Description

This pull request adds advanced cookie configuration capabilities to the I18n class. These changes allow for finer control over the behavior of cookies used to store user language preferences.

Changes made

  • Added new properties to configure cookies:
    • cookiePath
    • cookieDomain
    • cookieSecure
    • cookieHttpOnly
    • cookieSameSite
  • Updated the setcookie() method to use these new options
  • Added getters and setters for all new properties

Motivation

These changes provide developers using PHP-I18N with better control over cookie security and behavior. Specifically, they allow:

  • Limiting the scope of cookies (with cookiePath and cookieDomain)
  • Enhancing security (with cookieSecure and cookieHttpOnly)
  • Complying with new browser security policies (with cookieSameSite)

Potential impact

These modifications are backward compatible and do not affect the library's default behavior. Users who wish to benefit from these new options will need to configure them explicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant