Set-Cookie object

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

    Create a new SetCookie object from a string

      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 string|int|null
      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|null
      public isExpired() : bool
       

      Check if the cookie is expired

      public matchesDomain(string $domain) : bool
       

      Check if the cookie matches a domain value

        public matchesPath(string $requestPath) : bool
         

        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.
          public setDiscard( $discard) : void
           

          Set whether or not this is a session cookie

            public setDomain( $domain) : void
             

            Set the domain of the cookie

              public setExpires( $timestamp) : void
               

              Set the unix timestamp for which the cookie will expire

                public setHttpOnly( $httpOnly) : void
                 

                Set whether or not this is an HTTP only cookie

                  public setMaxAge( $maxAge) : void
                   

                  Set the max-age of the cookie

                    public setName( $name) : void
                     

                    Set the cookie name

                      public setPath( $path) : void
                       

                      Set the path of the cookie

                        public setSecure( $secure) : void
                         

                        Set whether or not the cookie is secure

                          public setValue( $value) : void
                           

                          Set the cookie value

                            public toArray() : array
                            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(string $cookie) : self
                             

                            Create a new SetCookie object from a string

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