URI

URI

웹 기술에서는 리소스를 가리키는 문자열인 URI(Uniform Resource Identifier)를 자주 다뤄요. 이 장은 URI를 다루는 함수와 클래스를 설명해요. 웹에서 리소스를 식별하는 데 쓰는 URI 문자열을 파싱하고 비교하고 구성하는 작업을 객체 지향으로 할 수 있어요.

출처: URI

본문

이 장은 URI(Uniform Resource Identifier)를 다루는 함수를 설명해요. URI는 리소스를 식별하는 데 쓰는 문자열이며, 웹 기술에서 인터넷의 리소스를 식별하는 데 사용돼요.

이 확장은 » RFC 3986(Uniform Resource Identifier (URI): Generic Syntax)과 » WHATWG URL Standard 사양을 따르는 기능을 구현해요.

Uri\Rfc3986\Uri 클래스

  • Uri\Rfc3986\Uri — Uri\Rfc3986\Uri 클래스
  • Uri\Rfc3986\Uri::__construct — Uri 객체를 생성해요(Construct the Uri object).
  • Uri\Rfc3986\Uri::__debugInfo — URI의 내부 상태를 반환해요(Return the internal state of the URI).
  • Uri\Rfc3986\Uri::equals — 두 URI가 동등한지 확인해요(Check if two URIs are equivalent).
  • Uri\Rfc3986\Uri::getFragment — 정규화된 fragment 컴포넌트를 가져와요(Retrieve the normalized fragment component).
  • Uri\Rfc3986\Uri::getHost — 정규화된 host 컴포넌트를 가져와요(Retrieve the normalized host component).
  • Uri\Rfc3986\Uri::getPassword — 정규화된 password를 가져와요(Retrieve the normalized password).
  • Uri\Rfc3986\Uri::getPath — 정규화된 path 컴포넌트를 가져와요(Retrieve the normalized path component).
  • Uri\Rfc3986\Uri::getPort — 정규화된 port 컴포넌트를 가져와요(Retrieve the normalized port component).
  • Uri\Rfc3986\Uri::getQuery — 정규화된 query 컴포넌트를 가져와요(Retrieve the normalized query component).
  • Uri\Rfc3986\Uri::getRawFragment — 원시 fragment 컴포넌트를 가져와요(Retrieve the raw fragment component).
  • Uri\Rfc3986\Uri::getRawHost — 원시 host 컴포넌트를 가져와요(Retrieve the raw host component).
  • Uri\Rfc3986\Uri::getRawPassword — 원시 password를 가져와요(Retrieve the raw password).
  • Uri\Rfc3986\Uri::getRawPath — 원시 path 컴포넌트를 가져와요(Retrieve the raw path component).
  • Uri\Rfc3986\Uri::getRawQuery — 원시 query 컴포넌트를 가져와요(Retrieve the raw query component).
  • Uri\Rfc3986\Uri::getRawScheme — 원시 scheme 컴포넌트를 가져와요(Retrieve the raw scheme component).
  • Uri\Rfc3986\Uri::getRawUserInfo — 원시 userinfo 컴포넌트를 가져와요(Retrieve the raw userinfo component).
  • Uri\Rfc3986\Uri::getRawUsername — 원시 username을 가져와요(Retrieve the raw username).
  • Uri\Rfc3986\Uri::getScheme — 정규화된 scheme 컴포넌트를 가져와요(Retrieve the normalized scheme component).
  • Uri\Rfc3986\Uri::getUserInfo — 정규화된 userinfo 컴포넌트를 가져와요(Retrieve the normalized userinfo component).
  • Uri\Rfc3986\Uri::getUsername — 정규화된 username을 가져와요(Retrieve the normalized username).
  • Uri\Rfc3986\Uri::parse — URI를 파싱해요(Parse a URI).
  • Uri\Rfc3986\Uri::resolve — 현재 객체를 기준 URI로 사용해 URI를 해석해요(Resolve a URI with the current object as the base URI).
  • Uri\Rfc3986\Uri::__serialize — Uri 객체를 직렬화해요(Serialize the Uri object).
  • Uri\Rfc3986\Uri::toRawString — 원시 URI를 재구성해요(Recompose the raw URI).
  • Uri\Rfc3986\Uri::toString — 정규화된 URI를 재구성해요(Recompose the normalized URI).
  • Uri\Rfc3986\Uri::__unserialize — 데이터 매개변수를 Uri 객체로 역직렬화해요(Deserialize the data parameter into a Uri object).
  • Uri\Rfc3986\Uri::withFragment — fragment 컴포넌트를 수정해요(Modify the fragment component).
  • Uri\Rfc3986\Uri::withHost — host 컴포넌트를 수정해요(Modify the host component).
  • Uri\Rfc3986\Uri::withPath — path 컴포넌트를 수정해요(Modify the path component).
  • Uri\Rfc3986\Uri::withPort — port 컴포넌트를 수정해요(Modify the port component).
  • Uri\Rfc3986\Uri::withQuery — query 컴포넌트를 수정해요(Modify the query component).
  • Uri\Rfc3986\Uri::withScheme — scheme 컴포넌트를 수정해요(Modify the scheme component).
  • Uri\Rfc3986\Uri::withUserInfo — userinfo 컴포넌트를 수정해요(Modify the userinfo component).

Uri\WhatWg\Url 클래스

  • Uri\WhatWg\Url — Uri\WhatWg\Url 클래스
  • Uri\WhatWg\Url::__construct — Url 객체를 생성해요(Construct the Url object).
  • Uri\WhatWg\Url::__debugInfo — URL의 내부 상태를 반환해요(Return the internal state of the URL).
  • Uri\WhatWg\Url::equals — 두 URL이 동등한지 확인해요(Check if two URLs are equivalent).
  • Uri\WhatWg\Url::getAsciiHost — host 컴포넌트를 ASCII 문자열로 가져와요(Retrieve the host component as an ASCII string).
  • Uri\WhatWg\Url::getFragment — fragment 컴포넌트를 가져와요(Retrieve the fragment component).
  • Uri\WhatWg\Url::getPassword — password 컴포넌트를 가져와요(Retrieve the password component).
  • Uri\WhatWg\Url::getPath — path 컴포넌트를 가져와요(Retrieve the path component).
  • Uri\WhatWg\Url::getPort — port 컴포넌트를 가져와요(Retrieve the port component).
  • Uri\WhatWg\Url::getQuery — query 컴포넌트를 가져와요(Retrieve the query component).
  • Uri\WhatWg\Url::getScheme — scheme 컴포넌트를 가져와요(Retrieve the scheme component).
  • Uri\WhatWg\Url::getUnicodeHost — host 컴포넌트를 Unicode 문자열로 가져와요(Retrieve the host component as an Unicode string).
  • Uri\WhatWg\Url::getUsername — username 컴포넌트를 가져와요(Retrieve the username component).
  • Uri\WhatWg\Url::parse — URL을 파싱해요(Parse a URL).
  • Uri\WhatWg\Url::resolve — 현재 객체를 기준 URL로 사용해 URL을 해석해요(Resolve a URL with the current object as the base URL).
  • Uri\WhatWg\Url::__serialize — Url 객체를 직렬화해요(Serialize the Url object).
  • Uri\WhatWg\Url::toAsciiString — URL을 ASCII 문자열로 재구성해요(Recompose the URL as an ASCII string).
  • Uri\WhatWg\Url::toUnicodeString — URL을 Unicode 문자열로 재구성해요(Recompose the URL as a Unicode string).
  • Uri\WhatWg\Url::__unserialize — 데이터 매개변수의 배열을 Url 객체로 역직렬화해요(Deserialize the array from the data parameter into a Url object).
  • Uri\WhatWg\Url::withFragment — fragment 컴포넌트를 수정해요(Modify the fragment component).
  • Uri\WhatWg\Url::withHost — host 컴포넌트를 수정해요(Modify the host component).
  • Uri\WhatWg\Url::withPassword — password 컴포넌트를 수정해요(Modify the password component).
  • Uri\WhatWg\Url::withPath — path 컴포넌트를 수정해요(Modify the path component).
  • Uri\WhatWg\Url::withPort — port 컴포넌트를 수정해요(Modify the port component).
  • Uri\WhatWg\Url::withQuery — query 컴포넌트를 수정해요(Modify the query component).
  • Uri\WhatWg\Url::withScheme — scheme 컴포넌트를 수정해요(Modify the scheme component).
  • Uri\WhatWg\Url::withUsername — username 컴포넌트를 수정해요(Modify the username component).

열거형·예외 클래스

  • Uri\UriComparisonMode — Uri\UriComparisonMode 열거형(enum)
  • Uri\UriException — Uri\UriException 클래스
  • Uri\UriError — Uri\UriError 클래스
  • Uri\InvalidUriException — Uri\InvalidUriException 클래스
  • Uri\WhatWg\InvalidUrlException — Uri\WhatWg\InvalidUrlException 클래스
  • Uri\WhatWg\InvalidUrlException::__construct — InvalidUrlException 객체를 생성해요(Construct an InvalidUrlException object).
  • Uri\WhatWg\UrlValidationError — Uri\WhatWg\UrlValidationError 클래스
  • Uri\WhatWg\UrlValidationError::__construct — UrlValidationError 객체를 생성해요(Construct a UrlValidationError object).
  • Uri\WhatWg\UrlValidationErrorType — Uri\WhatWg\UrlValidationErrorType 열거형(enum)

더 알아보기

  • RFC 3986과 WHATWG URL 표준의 차이(예: host 정규화 규칙)를 알면 두 클래스 계열(Rfc3986 vs WhatWg)을 선택할 기준이 생겨요.
  • getRaw* 계열과 get* 계열의 차이는 "원시 값"이냐 "정규화된 값"이냐예요. 이 차이를 짚고 보면 메서드가 많아 보여도 구조가 잡혀요.