All Projects → thephpleague → Uri Interfaces

thephpleague / Uri Interfaces

Licence: mit
League URI Interfaces

Labels

Projects that are alternatives of or similar to Uri Interfaces

Bidi
Bidirectional URI routing
Stars: ✭ 941 (+280.97%)
Mutual labels:  uri
React Native Wormhole
⚛️ 🌌 Inter-dimensional Portals for React Native. 👽 🖖
Stars: ✭ 133 (-46.15%)
Mutual labels:  uri
Uri Manipulations
Functions and Middleware to manipulate URI Objects
Stars: ✭ 202 (-18.22%)
Mutual labels:  uri
Sttp
The Scala HTTP client you always wanted!
Stars: ✭ 1,078 (+336.44%)
Mutual labels:  uri
Rdflib
RDFLib is a Python library for working with RDF, a simple yet powerful language for representing information.
Stars: ✭ 1,584 (+541.3%)
Mutual labels:  uri
Uriparser
🔪 Strictly RFC 3986 compliant URI parsing and handling library written in C89; moved from SourceForge to GitHub
Stars: ✭ 163 (-34.01%)
Mutual labels:  uri
Uri.js
Javascript URL mutation library
Stars: ✭ 6,119 (+2377.33%)
Mutual labels:  uri
Pguri
uri type for PostgreSQL
Stars: ✭ 235 (-4.86%)
Mutual labels:  uri
Embiggen
A Ruby library to expand shortened URLs
Stars: ✭ 122 (-50.61%)
Mutual labels:  uri
Uri Hostname Parser
A lightweight hostname parser according to public suffix list ICANN section
Stars: ✭ 198 (-19.84%)
Mutual labels:  uri
Request via
RequestVia: A Functional HTTP Client That Wraps Net::HTTP
Stars: ✭ 74 (-70.04%)
Mutual labels:  uri
Addressable
Addressable is an alternative implementation to the URI implementation that is part of Ruby's standard library. It is flexible, offers heuristic parsing, and additionally provides extensive support for IRIs and URI templates.
Stars: ✭ 1,313 (+431.58%)
Mutual labels:  uri
Uritemplate
URI template parsing per RFC6570
Stars: ✭ 188 (-23.89%)
Mutual labels:  uri
Handle Path Oz
Android Library to handle multiple Uri's(paths) received through Intents.
Stars: ✭ 36 (-85.43%)
Mutual labels:  uri
Uri Schemes
Collection of URI Immutable Value Objects
Stars: ✭ 221 (-10.53%)
Mutual labels:  uri
Badges4 Readme.md Profile
👩‍💻👨‍💻 Improve your README.md profile with these amazing badges.
Stars: ✭ 929 (+276.11%)
Mutual labels:  uri
Tldts
JavaScript Library to work against complex domain names, subdomains and URIs.
Stars: ✭ 151 (-38.87%)
Mutual labels:  uri
Uri Components
League URI components objects
Stars: ✭ 244 (-1.21%)
Mutual labels:  uri
Scala Uri
Simple scala library for building and parsing URIs
Stars: ✭ 225 (-8.91%)
Mutual labels:  uri
Vscode Remote Workspace
Multi protocol support for handling remote files like local ones in Visual Studio Code.
Stars: ✭ 197 (-20.24%)
Mutual labels:  uri

Uri Interfaces

This package contains an interface to represents URI objects according to RFC 3986.

System Requirements

You need:

  • PHP >= 7.1.3 but the latest stable version of PHP is recommended

Install

$ composer require league/uri-interfaces

Documentation

League\Uri\Contract\UriInterface

The UriInterface interface models generic URIs as specified in RFC 3986. The interface provides methods for interacting with the various URI parts, which will obviate the need for repeated parsing of the URI. It also specifies:

  • a __toString() method for casting the modeled URI to its string representation.
  • a jsonSerialize() method to improve interoperability with WHATWG URL Living standard

Accessing URI properties

The UriInterface interface defines the following methods to access the URI string representation, its individual parts and components.

<?php

public UriInterface::__toString(void): string
public UriInterface::jsonSerialize(void): string
public UriInterface::getScheme(void): ?string
public UriInterface::getUserInfo(void): ?string
public UriInterface::getHost(void): ?string
public UriInterface::getPort(void): ?int
public UriInterface::getAuthority(void): ?string
public UriInterface::getPath(void): string
public UriInterface::getQuery(void): ?string
public UriInterface::getFragment(void): ?string

Modifying URI properties

The Uri interface defines the following modifying methods. these methods must be implemented such that they retain the internal state of the current instance and return an instance that contains the changed state.

Delimiter characters are not part of the URI component and must not be added to the modifying method submitted value. If present they will be treated as part of the URI component content.

These methods will trigger a League\Uri\Contract\UriException exception if the resulting URI is not valid. The validation is scheme dependent.

<?php

public UriInterface::withScheme(?string $scheme): self
public UriInterface::withUserInfo(?string $user [, string $password = null]): self
public UriInterface::withHost(?string $host): self
public UriInterface::withPort(?int $port): self
public UriInterface::withPath(string $path): self
public UriInterface::withQuery(?string $query): self
public UriInterface::withFragment(?string $fragment): self

Relation with PSR-7

This interface exposes the same methods as Psr\Http\Message\UriInterface. But, differs on the following keys:

  • This interface does not require the http and https schemes to be supported.
  • Setter and Getter component methods, with the exception of the path component, accept and can return the null value.
  • If no scheme is present, you are not required to fallback to http and https schemes specific validation rules.

League\Uri\Contract\UriComponentInterface

The UriComponentInterface interface models generic URI components as specified in RFC 3986. The interface provides methods for interacting with an URI component, which will obviate the need for repeated parsing of the URI component. It also specifies a __toString() method for casting the modeled URI component to its string representation.

Accessing URI properties

The UriComponentInterface interface defines the following methods to access the URI component content.

<?php

public UriComponentInterface::__toString(void): string
public UriComponentInterface::getContent(void): ?string
public UriComponentInterface::getUriComponent(void): ?string
public UriComponentInterface::jsonSerialize(void): ?string

Modifying URI properties

The UriComponentInterface interface defines the following modifying method. this method must be implemented such that it retains the internal state of the current instance and return an instance that contains the changed state.

<?php

public UriComponentInterface::withContent(?string $content): static

UriComponentInterface extended interfaces

Because each URI component has specific needs most have specialized interface which all extends the UriComponentInterface interface. The following interfaces also exist:

  • League\Uri\Contract\AuthorityInterface
  • League\Uri\Contract\DataPathInterface
  • League\Uri\Contract\DomainHostInterface
  • League\Uri\Contract\FragmentInterface
  • League\Uri\Contract\UserInfoInterface
  • League\Uri\Contract\HostInterface
  • League\Uri\Contract\IpHostInterface
  • League\Uri\Contract\PathInterface
  • League\Uri\Contract\PortInterface
  • League\Uri\Contract\QueryInterface
  • League\Uri\Contract\SegmentedPathInterface

Contributing

Contributions are welcome and will be fully credited. Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].