PHP code example of bickmista / spurl

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

    

bickmista / spurl example snippets


$url = 'http://test.com/example/path?some=query#anchor';

$splitUrl = Spurl\Url::shatter($url);

$splitUrl = [
  'protocol' => 'http',
  'host' => 'test.com',
  'path' => 'example/path',
  'query' => 'some=query',
  'anchor' => 'anchor'
];

$url = 'http://test.com/';

$splitUrl = Spurl\Url::shatter($url, true);

$splitUrl = [
  'protocol' => 'http',
  'host' => [
    'domain' => 'test',
    'suffix' => 'com'
  ]
];