1. Go to this page and download the library: Download dariof28/url-builder 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/ */
dariof28 / url-builder example snippets
use DariofDev\UrlBuilder\Url;
$url = new Url('foo.bar'); // https://foo.bar
use DariofDev\UrlBuilder\Url;
$url = (new Url('foo.bar'))
->setProtocol('sftp'); // sftp://foo.bar
use DariofDev\UrlBuilder\Url;
$url = (new Url('foo.bar'))
->setPort(8000); // https://foo.bar:8000
use DariofDev\UrlBuilder\Url;
$url = (new Url('foo.bar'))
->setPath('baz'); // https://foo.bar/baz
use DariofDev\UrlBuilder\Url;
$url = (new Url('foo.bar'))
->setPath('baz/%s', [1]); // https://foo.bar/baz/1
use DariofDev\UrlBuilder\Url;
$url = new Url('foo.bar', ['foo' => 'bar']); // https://foo.bar?foo=bar
use DariofDev\UrlBuilder\Url;
$url = (new Url('foo.bar'))
->addParam('foo', 'bar')
->addParam('bar', ['baz' => 'foo']); // https://foo.bar?foo=bar&bar%5Bbaz%5D=foo
shell
./vendor/bin/php-cs-fixer fix
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.