talesoft / tale-uri
A basic, lightweight PSR-7 and PSR-17 compatible URI implementation
Installs: 18
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
pkg:composer/talesoft/tale-uri
Requires
- php: >=7.1.0
- psr/http-factory: ^1.0
- psr/http-message: ^1.0
Requires (Dev)
- talesoft/tale-dev-tool: dev-master
This package is auto-updated.
Last update: 2025-10-27 04:12:15 UTC
README
Tale Uri
What is Tale Uri?
This is a basic and lightweight implementation of the
Psr\Http\Message\UriInterface and the Psr\Http\Message\UriFactoryInterface.
It doesn't add any extra methods, they are straight and direct implementations without any overhead.
It's useful in cases where you simply just want URI abstraction,
but not a full HTTP layer with it. It's also useful for library
authors for testing with dependencies on Psr\Http\Message\UriInterface
Installation
composer req talesoft/tale-uri
Usage
Check out the Functions File to see all things this library does.
Parse and modify URIs easily
use function Tale\uri_parse; $uri = uri_parse('https://google.com/search'); //$uri is a strict implementation of PSR-7's UriInterface echo $uri->getScheme(); //"https" echo $uri->getHost(); "google.com" echo $uri->getPath(); //"/search" echo $uri->withHost("talesoft.codes"); "https://talesoft.codes/search"
Create an URI factory for DI containers
use Psr\Http\Message\UriFactoryInterface; use Tale\UriFactory; $container->add(UriFactory::class); //... $uriFactory = $container->get(UriFactoryInterface::class); $uri = $uriFactory->createUri('https://example.com#test'); echo $uri->getFragment(); //"test"