https://github.com/baraja-core/url
Simple URL parser and manager.
https://github.com/baraja-core/url
manager parser url url-parser
Last synced: 4 months ago
JSON representation
Simple URL parser and manager.
- Host: GitHub
- URL: https://github.com/baraja-core/url
- Owner: baraja-core
- License: mit
- Created: 2021-01-20T08:24:14.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-23T04:36:21.000Z (almost 2 years ago)
- Last Synced: 2025-06-12T10:47:01.270Z (5 months ago)
- Topics: manager, parser, url, url-parser
- Language: PHP
- Homepage: https://php.baraja.cz
- Size: 29.3 KB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/funding.yml
- License: LICENSE
Awesome Lists containing this project
README
Baraja safe URL
===============

Simple manager to get parts of the current URL. URL resolving is done in a secure way.
📦 Installation
---------------
It's best to use [Composer](https://getcomposer.org) for installation, and you can also find the package on
[Packagist](https://packagist.org/packages/baraja-core/url) and
[GitHub](https://github.com/baraja-core/url).
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:
```php
echo \Baraja\Url\Url::get()->getCurrentUrl();
```
A base URL:
```php
echo \Baraja\Url\Url::get()->getBaseUrl();
```
Or relative URL:
```php
// 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:
```php
$netteUrl = \Baraja\Url\Url::get()->getNetteUrl();
echo $netteUrl->getDomain();
echo $netteUrl->getPort();
echo $netteUrl->getQuery();
```
And many other getters, [see the documentation](https://github.com/nette/http) for more.
📄 License
-----------
`baraja-core/url` is licensed under the MIT license. See the [LICENSE](https://github.com/baraja-core/url/blob/master/LICENSE) file for more details.