PHP code example of veejay / address

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

    

veejay / address example snippets


$url = 'https://domain.ru/index.php?arg=value#anchor';
$address = new \veejay\address\Address($url);

// Relative address
$address->path = 'test.php';
$address->fragment = 'h1';
echo $address->rel(); // /test.php?arg=value#h1

// Absolute address
$address->query = ['param' => 1];
$address->fragment = null;
echo $address->abs(); // https://domain.ru/test.php?param=1