PHP code example of baraja-core / url

1. Go to this page and download the library: Download baraja-core/url library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

baraja-core / url example snippets


echo \Baraja\Url\Url::get()->getCurrentUrl();

echo \Baraja\Url\Url::get()->getBaseUrl();

// return with query parameters (if used)
echo \Baraja\Url\Url::get()->getRelativeUrl();

// return only path
echo \Baraja\Url\Url::get()->getRelativeUrl(false);

$netteUrl = \Baraja\Url\Url::get()->getNetteUrl();

echo $netteUrl->getDomain();
echo $netteUrl->getPort();
echo $netteUrl->getQuery();