Break a URL up into it's parts.

$url = new Barebone\URL( 'http://frank:test1@example.com:8080/samples/url/index/?a=a&b=b#fragmented' ); 
echo $url->getScheme();
echo $url->getUser();
echo $url->getHost();
http://frank:test1@example.com:8080/samples/url/index/?a=a&b=b#fragmented
Scheme User Pass Host Port Path Params Fragment
http frank test1 example.com 8080 /samples/url/index/ a=a&b=b fragmented

Build URL From array

    $segments = array('frontend', 'show', 'action');
    $url = Barebone\URL();
    echo $url->build($segments);
/frontend/show/action/
  • Barebone\URL

    Barebone\URL
    • [P] $defaultports : array
    • [P] $scheme : string
    • [P] $user : string
    • [P] $password : string
    • [P] $host : string
    • [P] $port : int
    • [P] $path : string
    • [P] $query : mixed
    • [P] $fragment : string
    • [P] $absoluteUrl : string
    • [P] $authority : string
    • [P] $hostUrl : string
    • [P] $basePath : string
    • [P] $baseUrl : string
    • [P] $relativeUrl : string
    • [P] $fullUrl : string
    • [P] $queryParameters : array
    • [M] __construct( mixed $url ) : void
    • [M] build( array $segments ) : void
    • [M] getDefaultports() : void
    • [M] setDefaultports( $defaultports ) : void
    • [M] getScheme() : void
    • [M] setScheme( string $scheme ) : void
    • [M] getUser() : void
    • [M] setUser( string $user ) : void
    • [M] getPassword() : void
    • [M] setPassword( string $password ) : void
    • [M] getHost() : void
    • [M] setHost( string $host ) : void
    • [M] getPort() : void
    • [M] setPort( int $port ) : void
    • [M] getPath() : void
    • [M] setPath( string $path ) : void
    • [M] getQueryParameters() : void
    • [M] getQuery() : void
    • [M] setQuery( mixed $query ) : void
    • [M] appendQuery( mixed $query ) : void
    • [M] getQueryParameter( string $name, string $default ) : void
    • [M] setQueryParameter( string $name, string $value ) : void
    • [M] getFragment() : void
    • [M] setFragment( string $fragment ) : void
    • [M] getAbsoluteUrl() : string
    • [M] getAuthority() : string
    • [M] getHostUrl() : string
    • [M] getBasePath() : string
    • [M] getBaseUrl() : string
    • [M] getRelativeUrl() : string
    • [M] isEqual( $url ) : bool
    • [M] canonicalize() : void
    • [M] __toString() : string
    • [M] jsonSerialize() : string
    • [M] unescape( string $s, string $reserved ) : string
    • [M] parseQuery( string $s ) : array
    • [M] contains( string $s ) : bool
    • [M] beginsWith( string $s ) : bool
    • [M] endsWith( string $s ) : bool
    • [M] indexOf( string $s ) : mixed