Skip to content

baraja-core/url

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Baraja safe URL

Integrity check

Simple manager to get parts of the current URL. URL resolving is done in a secure way.

📦 Installation

It's best to use Composer for installation, and you can also find the package on Packagist and GitHub.

To install, simply use the command:

$ composer require baraja-core/url

You can use the package manually by creating an instance of the internal classes, or register a DIC extension to link the services directly to the Nette Framework.

How to use

An easy-to-use library for obtaining and managing current URLs.

You will get the current URL:

echo \Baraja\Url\Url::get()->getCurrentUrl();

A base URL:

echo \Baraja\Url\Url::get()->getBaseUrl();

Or relative URL:

// return with query parameters (if used)
echo \Baraja\Url\Url::get()->getRelativeUrl();

// return only path
echo \Baraja\Url\Url::get()->getRelativeUrl(false);

Nette Url or Script Url can also be obtained for robust work with URL parts:

$netteUrl = \Baraja\Url\Url::get()->getNetteUrl();

echo $netteUrl->getDomain();
echo $netteUrl->getPort();
echo $netteUrl->getQuery();

And many other getters, see the documentation for more.

📄 License

baraja-core/url is licensed under the MIT license. See the LICENSE file for more details.