Please consider using the the latest stable version for any production code.

The Scheme component

The library provides a Scheme class to ease scheme creation and manipulation.

Creating a new object

<?php
public Scheme::__construct(?string $content = null): void

If the submitted value is not valid a League\Uri\Components\Exception exception is thrown.

The League\Uri\Components\Exception extends PHP’s SPL InvalidArgumentException.

Properties and methods

This URI component object only exposes the package common API.

Usage

<?php

use League\Uri\Components\Scheme;

$scheme = new Scheme('FtP');
$scheme->isNull();  //return false
$scheme->isEmpty(); //return false
echo $scheme->getContent();                         //display 'ftp'
echo $scheme->getContent(Scheme::RFC3986_ENCODING); //display 'ftp'
echo $scheme->getContent(Scheme::RFC3987_ENCODING); //display 'ftp'
echo $scheme->getContent(Scheme::NO_ENCODING);      //display 'ftp'
echo $scheme;                    //display 'ftp'
echo $scheme->getUriComponent(); //display 'ftp:'

$new_scheme = $scheme->withContent(null);
$new_scheme->isNull();  //return true
$new_scheme->isEmpty(); //return true
echo $new_scheme->getContent();      //display null
echo $new_scheme;                    //display ''
echo $new_scheme->getUriComponent(); //display ''

The delimiter : is not part of the component value and must not be added.

If the submitted value is not valid a League\Uri\Components\Exception exception is thrown.