Skip to content

Uri: withUserInfo Example

Terry L edited this page Jun 20, 2020 · 4 revisions

Shieldon\Psr7\Uri

withUserInfo($user, $password)

Return an instance with the specified user information.

  • param string user * The user name to use for authority.
  • param string|null password = null The password associated with $user.
  • return static

Example:

echo $uri->getUserInfo();
// Outputs: terry:1234

$url = $uri->withUserInfo('jack', '5678');

echo $uri->getUserInfo();
// Outputs: jack:5678
Clone this wiki locally