baraja-core / url
Simple URL manager.
Installs: 372 587
Dependents: 20
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 2
Open Issues: 1
Requires
- php: ^8.0
- nette/http: ^3.1
Requires (Dev)
- phpstan/extension-installer: ^1.0
- phpstan/phpstan: ^0.12.94
- phpstan/phpstan-deprecation-rules: ^0.12.6
- phpstan/phpstan-nette: ^0.12.14
- phpstan/phpstan-strict-rules: ^0.12.10
- roave/security-advisories: dev-master
- spaze/phpstan-disallowed-calls: ^1.1
- tracy/tracy: ^2.8
This package is auto-updated.
Last update: 2024-10-23 06:22:26 UTC
README
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.