Set-Cookie object

CloneableInstantiable
Methods
public __construct(array $data = [])
 
    public __toString()
    public static fromString( $cookie)
     

    Create a new SetCookie object from a string

    • return self
    public getDiscard()
     

    Get whether or not this is a session cookie

    • return bool|null
    public getDomain()
     

    Get the domain

    • return string|null
    public getExpires()
     

    The UNIX timestamp when the cookie Expires

    • return mixed
    public getHttpOnly()
     

    Get whether or not this is an HTTP only cookie

    • return bool
    public getMaxAge()
     

    Maximum lifetime of the cookie in seconds

    • return int|null
    public getName()
     

    Get the cookie name

    • return string
    public getPath()
     

    Get the path

    • return string
    public getSecure()
     

    Get whether or not this is a secure cookie

    • return bool|null
    public getValue()
     

    Get the cookie value

    • return string
    public isExpired()
     

    Check if the cookie is expired

    • return bool
    public matchesDomain( $domain)
     

    Check if the cookie matches a domain value

    • return bool
    public matchesPath( $requestPath)
     

    Check if the cookie matches a path value.

    A request-path path-matches a given cookie-path if at least one of
    the following conditions holds:

    • The cookie-path and the request-path are identical.
    • The cookie-path is a prefix of the request-path, and the last
      character of the cookie-path is %x2F ("/").
    • The cookie-path is a prefix of the request-path, and the first
      character of the request-path that is not included in the cookie-
      path is a %x2F ("/") character.
    • return bool
    public setDiscard( $discard)
     

    Set whether or not this is a session cookie

      public setDomain( $domain)
       

      Set the domain of the cookie

        public setExpires( $timestamp)
         

        Set the unix timestamp for which the cookie will expire

          public setHttpOnly( $httpOnly)
           

          Set whether or not this is an HTTP only cookie

            public setMaxAge( $maxAge)
             

            Set the max-age of the cookie

              public setName( $name)
               

              Set the cookie name

                public setPath( $path)
                 

                Set the path of the cookie

                  public setSecure( $secure)
                   

                  Set whether or not the cookie is secure

                    public setValue( $value)
                     

                    Set the cookie value

                      public toArray()
                      public validate()
                       

                      Check if the cookie is valid according to RFC 6265

                      • return bool|string Returns true if valid or an error message if invalid
                      Properties
                      private $data
                       
                      • var array Cookie data
                      private static $defaults = ['Name' => NULL, 'Value' => NULL, 'Domain' => NULL, 'Path' => '/', 'Max-Age' => NULL, 'Expires' => NULL, 'Secure' => false, 'Discard' => false, 'HttpOnly' => false]
                       
                      • var array
                      Properties
                      private static $defaults = ['Name' => NULL, 'Value' => NULL, 'Domain' => NULL, 'Path' => '/', 'Max-Age' => NULL, 'Expires' => NULL, 'Secure' => false, 'Discard' => false, 'HttpOnly' => false]
                       
                      • var array
                      Methods
                      public static fromString( $cookie)
                       

                      Create a new SetCookie object from a string

                      • return self
                      © 2020 Bruce Wells
                      Search Namespaces \ Classes
                      ConfigurationNumbers (0-9.) only