https://github.com/baraja-core/url
Simple URL parser and manager.
https://github.com/baraja-core/url
manager parser url url-parser
Last synced: 17 days 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 (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-01-23T04:36:21.000Z (over 1 year ago)
- Last Synced: 2025-03-24T13:05:23.928Z (about 1 month 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.