__construct() public method

Constructor.
public __construct ( string $name, string | null $value = null, integer | string | DateTimeInterface $expire, string $path = '/', string | null $domain = null, boolean $secure = false, boolean $httpOnly = true, boolean $raw = false, string | null $sameSite = null )
$name string The name of the cookie
$value string | null The value of the cookie
$expire integer | string | DateTimeInterface The time the cookie expires
$path string The path on the server in which the cookie will be available on
$domain string | null The domain that the cookie is available to
$secure boolean Whether the cookie should only be transmitted over a secure HTTPS connection from the client
$httpOnly boolean Whether the cookie will be made accessible only through the HTTP protocol
$raw boolean Whether the cookie value should be sent with no url encoding
$sameSite string | null Whether the cookie will be available for cross-site requests
Example #1
0
 public function __construct($name, $value, $expire, $path, $domain, $secure, $httpOnly, $raw)
 {
     self::$crypt = env("COOKIE_CRYPT", null);
     if (!is_null(self::$crypt)) {
         $_crypt = strpos(self::$crypt, ".");
         self::$cryptType = strtoupper(substr(self::$crypt, 0, $_crypt));
         self::$cryptLength = intval(substr(self::$crypt, $_crypt + 1));
     }
     $value = self::cryptValue($value);
     parent::__construct($name, $value, $expire, $path, $domain, $secure, $httpOnly, $raw);
 }
Example #2
0
 public function __construct(Context $context, $name, $value = null, $expire = 0, $path = '/', $domain = null, $secure = false, $httpOnly = false)
 {
     $config = $context->getService('config');
     parent::__construct($config->get('foolz/foolframe', 'config', 'config.cookie_prefix') . $name, $value, time() + $expire, $path, $domain, $secure, $httpOnly);
 }
Example #3
0
 /**
  * Override parent construct httpOnly to false
  * @param string $name
  * @param null $value
  * @param null $expire
  * @param string $path
  * @param null $domain
  * @param bool $secure
  * @param bool $httpOnly
  *
  */
 public function __construct($name, $value = null, $expire = null, $path = '/', $domain = null, $secure = false, $httpOnly = false)
 {
     parent::__construct($name, $value, $expire, $path, $domain, $secure, $httpOnly);
 }