prob / url-helper
A simple library for handling path of url and matching url easily
Installs: 404
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 1
pkg:composer/prob/url-helper
Requires
- php: >=5.4
Requires (Dev)
This package is not auto-updated.
Last update: 2025-10-26 00:56:08 UTC
README
A simple library for handling path of url and matching url easily
Usage
Simple path parser
Path class is separating url segments
<?php use Prob\Url\Path; $path = new Path('/apple/banana'); echo $path->seg(0); // apple echo $path->seg(1); // banana print_r($path->segments()); // Array ( 'apple', 'banana' )
Simple url matching
Matchar class is checking the url matching
<?php use Prob\Url\Matcher; $pathA = new Matcher('/apple'); print_r($pathA->match('/apple')); // Array ( ) print_r($pathA->match('/banana')); // false $pathB = new Matcher('/apple/banana'); print_r($pathB->match('/apple/banana')); // Array ( ) print_r($pathB->match('/apple')); // false print_r($pathB->match('/banana')); // false $pathC = new Matcher('/{board}/{post:int}'); print_r($pathC->match('/free/5')); // Array ( 'board' => 'free', 'post' => '5' ) print_r($pathC->match('/free')); // false print_r($pathC->match('/free/some')); // false
support type
- string
- int