jmsfwk / surlf
A library for formatting urls in the style of printf strings.
Installs: 108
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/jmsfwk/surlf
Requires (Dev)
- phpunit/phpunit: ^7.4
This package is auto-updated.
Last update: 2025-09-29 02:28:09 UTC
README
Usage
use Jmsfwk\Surlf\Formatter; echo Formatter::format('%h/%p', 'http://example.com/a-path'); // example.com/a-path
Formats
The examples in the table below are based on the url http://example.com/a/b/c?d=e&f=g
.
Format character | Description | Example |
---|---|---|
s | URL scheme | http |
h | Host | example.com |
p | Path | a/b/c |
q | Query | d=e&f=g |
% | Literal % character | % |