PHP code example of sitegeist / base-url

1. Go to this page and download the library: Download sitegeist/base-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/ */

    

sitegeist / base-url example snippets


\Sitegeist\BaseUrl\Helper\BaseUrl::get(); // https://example.com/

\Sitegeist\BaseUrl\Helper\BaseUrl::prepend('home.html'); // https://example.com/home.html

    BaseUrl::get('mysite');
    BaseUrl::prepend('home.html', 'mysite');
    

    BaseUrl::get(null, 1);
    BaseUrl::prepend('home.html', null, 1);
    

BaseUrl::get(null, null, true, false);

BaseUrl::prepend('home.html', null, null, true, false);
/*
TYPO3\CMS\Core\Http\Uri prototype object
   scheme => protected "https" (5 chars)
   supportedSchemes => protected array(2 items)
      http => 80 (integer)
      https => 443 (integer)
   authority => protected "" (0 chars)
   userInfo => protected "" (0 chars)
   host => protected "example.com" (11 chars)
   port => protected NULL
   path => protected "home.html" (9 chars)
   query => protected "" (0 chars)
   fragment => protected NULL
*/