PHP code example of uri-interop / interface

1. Go to this page and download the library: Download uri-interop/interface library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

uri-interop / interface example snippets


  public ?string $scheme { get; }
  

  public ?percent_encoded_string $username { get; }
  

  public ?percent_encoded_string $password { get; }
  

  public ?percent_composed_string $host { get; }
  

  public ?int $port { get; }
  

  public percent_composed_string $path { get; }
  

  public ?composed_string $query { get; }
  

  public ?percent_composed_string $fragment { get; }
  

  public ?query_params_array $queryParams { get; }
  

  public ?percent_composed_string $userinfo { get; }
  

  public ?percent_composed_string $authority { get; }
  

  public function __toString() : composed_string;
  

  public ?string $scheme { get; set; }
  

  public ?percent_encoded_string $username { get; set; }
  

  public ?percent_encoded_string $password { get; set; }
  

  public ?percent_composed_string $host { get; set; }
  

  public ?int $port { get; set; }
  

  public percent_composed_string $path { get; set; }
  

  public ?composed_string $query { get; set; }
  

  public ?percent_composed_string $fragment { get; set; }
  

  public ?query_params_array $queryParams { get; set; }
  

  public function withScheme(?string $scheme) : ImmutableUriStruct;
  

  public function withUsername(
      ?percent_encoded_string $username,
  ) : ImmutableUriStruct;
  

  public function withPassword(
      ?percent_encoded_string $password,
  ) : ImmutableUriStruct;
  

  public function withHost(?percent_composed_string $host) : ImmutableUriStruct;
  

  public function withPort(?int $port) : ImmutableUriStruct;
  

  public function withPath(percent_composed_string $path) : ImmutableUriStruct;
  

  public function withQuery(?composed_string $query) : ImmutableUriStruct;
  

  public function withFragment(
      ?percent_composed_string $fragment,
  ) : ImmutableUriStruct;
  

  public function withQueryParams(
      ?query_params_array $queryParams,
  ) : ImmutableUriStruct;
  

  public function newUri(
      ?string $scheme = null,
      ?percent_encoded_string $username = null,
      ?percent_encoded_string $password = null,
      ?percent_composed_string $host = null,
      ?int $port = null,
      percent_composed_string $path = '',
      ?composed_string $query = null,
      ?percent_composed_string $fragment = null,
  ) : UriStruct;
  

  public function normalizeUri(UriStruct $uri) : UriStruct;
  

  public function resolveUri(UriStruct $base, UriStruct $relative) : UriStruct;
  

  public function parseUri(string|Stringable $uriString) : UriStruct;