PHP code example of proteins / url

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

    

proteins / url example snippets


use Proteins\URL;

$url = new URL('https://user:[email protected]:9080/path/to/resource.html?foo=bar&another[]=2&another[]=3#frag_link');

print_r($url);

echo "$url";

$url = new URL();

$url->host = 'caffeina.com';
$url->user = 'demo';

echo $url;

$url = new URL("ftps://test.com:9000/index.php");

$url->scheme = 'https';
$url->port = false;

echo $url;

$link = new URL('mailto://');
$link->user = 'info';
$link->host = 'myserver.com';

$link->query['subject'] = 'This is a subject';
$link->query['body'] = 'Hi! This is a test... :D';

echo $link;

https://test.com/index.php