src/Http/Auth.php
public static function decode($header)
    {
        $data = [
            'realm'    => null,
            'username' => null,
            'uri'      => null,
            'nonce'    => null,
            'opaque'   => null,
            'qop'      => null,
            'cnonce'   => null,
            'nc'       => null,
            'response' => null
        ];
        $keys = implode('|', array_keys($data));
        $regex = '~(' . $keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))~';
        preg_match_all($regex, $header, $matches, PREG_SET_ORDER);

        foreach ($matches as $m) {
            $data[$m[1]] = $m[3] ? $m[3] : $m[4];
        }
        return $data;
    }
public static function decode($header)
    {
        $data = [
            'realm'    => null,
            'username' => null,
            'uri'      => null,
            'nonce'    => null,
            'opaque'   => null,
            'qop'      => null,
            'cnonce'   => null,
            'nc'       => null,
            'response' => null
        ];
        $keys = implode('|', array_keys($data));
        $regex = '~(' . $keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))~';
        preg_match_all($regex, $header, $matches, PREG_SET_ORDER);

        foreach ($matches as $m) {
            $data[$m[1]] = $m[3] ? $m[3] : $m[4];
        }
        return $data;
    }
public static function decode ( $ header ) { $ data = [ 'realm' => null , 'username' => null , 'uri' => null , 'nonce' => null , 'opaque' => null , 'qop' => null , 'cnonce' => null , 'nc' => null , 'response' => null ] ; $ keys = implode ( '|' , array_keys ( $ data ) ) ; $ regex = '~(' . $ keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))~' ; preg_match_all ( $ regex , $ header , $ matches , PREG_SET_ORDER ) ; foreach ( $ matches as $ m ) { $ data [ $ m [ 1 ] ] = $ m [ 3 ] ? $ m [ 3 ] : $ m [ 4 ] ; } return $ data ; }
Takes the header string and parses out the params needed for a digest authentication.

@param string $header
@return array
Takes the header string and parses out the params needed for a digest authentication .