You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Cookie.php 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. namespace Config;
  3. use CodeIgniter\Config\BaseConfig;
  4. use DateTimeInterface;
  5. class Cookie extends BaseConfig
  6. {
  7. /**
  8. * --------------------------------------------------------------------------
  9. * Cookie Prefix
  10. * --------------------------------------------------------------------------
  11. *
  12. * Set a cookie name prefix if you need to avoid collisions.
  13. *
  14. * @var string
  15. */
  16. public $prefix = '';
  17. /**
  18. * --------------------------------------------------------------------------
  19. * Cookie Expires Timestamp
  20. * --------------------------------------------------------------------------
  21. *
  22. * Default expires timestamp for cookies. Setting this to `0` will mean the
  23. * cookie will not have the `Expires` attribute and will behave as a session
  24. * cookie.
  25. *
  26. * @var DateTimeInterface|int|string
  27. */
  28. public $expires = 0;
  29. /**
  30. * --------------------------------------------------------------------------
  31. * Cookie Path
  32. * --------------------------------------------------------------------------
  33. *
  34. * Typically will be a forward slash.
  35. *
  36. * @var string
  37. */
  38. public $path = '/';
  39. /**
  40. * --------------------------------------------------------------------------
  41. * Cookie Domain
  42. * --------------------------------------------------------------------------
  43. *
  44. * Set to `.your-domain.com` for site-wide cookies.
  45. *
  46. * @var string
  47. */
  48. public $domain = '';
  49. /**
  50. * --------------------------------------------------------------------------
  51. * Cookie Secure
  52. * --------------------------------------------------------------------------
  53. *
  54. * Cookie will only be set if a secure HTTPS connection exists.
  55. *
  56. * @var bool
  57. */
  58. public $secure = false;
  59. /**
  60. * --------------------------------------------------------------------------
  61. * Cookie HTTPOnly
  62. * --------------------------------------------------------------------------
  63. *
  64. * Cookie will only be accessible via HTTP(S) (no JavaScript).
  65. *
  66. * @var bool
  67. */
  68. public $httponly = true;
  69. /**
  70. * --------------------------------------------------------------------------
  71. * Cookie SameSite
  72. * --------------------------------------------------------------------------
  73. *
  74. * Configure cookie SameSite setting. Allowed values are:
  75. * - None
  76. * - Lax
  77. * - Strict
  78. * - ''
  79. *
  80. * Alternatively, you can use the constant names:
  81. * - `Cookie::SAMESITE_NONE`
  82. * - `Cookie::SAMESITE_LAX`
  83. * - `Cookie::SAMESITE_STRICT`
  84. *
  85. * Defaults to `Lax` for compatibility with modern browsers. Setting `''`
  86. * (empty string) means default SameSite attribute set by browsers (`Lax`)
  87. * will be set on cookies. If set to `None`, `$secure` must also be set.
  88. *
  89. * @var string
  90. */
  91. public $samesite = 'Lax';
  92. /**
  93. * --------------------------------------------------------------------------
  94. * Cookie Raw
  95. * --------------------------------------------------------------------------
  96. *
  97. * This flag allows setting a "raw" cookie, i.e., its name and value are
  98. * not URL encoded using `rawurlencode()`.
  99. *
  100. * If this is set to `true`, cookie names should be compliant of RFC 2616's
  101. * list of allowed characters.
  102. *
  103. * @var bool
  104. *
  105. * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes
  106. * @see https://tools.ietf.org/html/rfc2616#section-2.2
  107. */
  108. public $raw = false;
  109. }