cyve/url

URL manipulation

2.0.0 2024-07-26 13:19 UTC

This package is auto-updated.

Last update: 2025-02-26 14:27:39 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