cyve/url

URL manipulation

1.4.3 2021-05-16 19:15 UTC

This package is auto-updated.

Last update: 2024-04-17 01:48:51 UTC


README

URL manipulation

Installation

$ composer require cyve/url

Usage

use Cyve\Url\Url;

$url = new Url('https://user:pwd@www.domain.tld:8080/foo/bar?key=value#hash');

echo $url->scheme; // https
echo $url->username; // user
echo $url->password; // pwd
echo $url->host; // www.domain.tld
echo $url->subDomain; // www
echo $url->domain; // domain.tld
echo $url->tld; // tld
echo $url->port; // 8080
echo $url->path; // /foo/bar
echo $url->path[0]; // foo
echo $url->path[1]; // bar
echo $url->query; // key=value
echo $url->query->get('key'); // value
echo $url->query->get('undefined', 'default'); // default
echo $url->fragment; // hash