The Scheme component

The Scheme class represents the URI scheme component and only exposes the package common API.

<?php

use League\Uri\Components\Scheme;

$scheme = Scheme::new('FtP');
echo $scheme->value();           //display 'ftp'
echo $scheme->toString();        //display 'ftp'
echo $scheme;                    //display 'ftp'
echo $scheme->getUriComponent(); //display 'ftp:'

$new_scheme = Scheme::new();
echo $new_scheme->value();           //display null
echo $new_scheme->toString();        //display ''
echo $new_scheme;                    //display ''
echo $new_scheme->getUriComponent(); //display ''

$alt_scheme = Scheme::fromUri('email:toto@example.com');
echo $alt_scheme->value();           //display 'email'
echo $alt_scheme->toString();        //display 'email'
echo $alt_scheme;                    //display 'email'
echo $alt_scheme->getUriComponent(); //display 'email'

The object can not be modified, you are required to instantiate a new object.

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

If the submitted value is not valid a League\Uri\Exceptions\SyntaxError exception is thrown.