Naify\Psr\Contract\UriInterface インターフェース
implements
Stringable
URI インターフェース — PSR-7 UriInterface 相当
scheme / host / port / path / query / fragment を不変オブジェクトとして扱う。 Router や Request は、この契約を通して URI の各要素へアクセスする。
使用例
$uri = $uri
->withPath('/docs/install')
->withQuery('lang=ja');
メソッド
| メソッド | 説明 |
|---|---|
public
getScheme(): string
|
URI スキーム ("http", "https") を返す。空文字は未設定 |
public
getAuthority(): string
|
authority 部分 ([user-info@]host[:port]) を返す |
public
getUserInfo(): string
|
user-info (user[:password]) を返す |
public
getHost(): string
|
ホスト名を返す。IPv6 は括弧付き ([::1]) |
public
getPort(): ?int
|
ポート番号を返す。スキームの標準ポートなら null |
public
getPath(): string
|
パス部分を返す。先頭の "/" を含む |
public
getQuery(): string
|
クエリ文字列を返す。"?" は含まない |
public
getFragment(): string
|
フラグメントを返す。"#" は含まない |
public
withScheme(string $scheme): static
|
スキームを差し替えた新インスタンスを返す |
public
withUserInfo(string $user, ?string $password): static
|
user-info を差し替えた新インスタンスを返す |
public
withHost(string $host): static
|
ホストを差し替えた新インスタンスを返す |
public
withPort(?int $port): static
|
ポートを差し替えた新インスタンスを返す |
public
withPath(string $path): static
|
パスを差し替えた新インスタンスを返す |
public
withQuery(string $query): static
|
クエリ文字列を差し替えた新インスタンスを返す |
public
withFragment(string $fragment): static
|
フラグメントを差し替えた新インスタンスを返す |