https://github.com/nggit/php-simple-uri-router
A Simple URI Router
https://github.com/nggit/php-simple-uri-router
Last synced: about 1 month ago
JSON representation
A Simple URI Router
- Host: GitHub
- URL: https://github.com/nggit/php-simple-uri-router
- Owner: nggit
- Created: 2018-11-19T01:14:32.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-09T00:52:06.000Z (almost 7 years ago)
- Last Synced: 2024-05-01T17:24:36.851Z (almost 2 years ago)
- Language: PHP
- Size: 3.91 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PHP Simple URI Router Quick Tour
**Tip:** Rename this `md` file to `php` to test it on your web server.
parse($uri);
### Get the first uri segment
echo $path->first(); // fruit.name
echo '
';
### Get the first uri segment, before certain token
echo $path->first('.?&'); // fruit
echo '
';
### Get an uri segment after another segment
echo $path->after('apple'); // banana
echo '
';
### Get n uri segment after another segment
echo $path->after('apple', 2); // banana/melon
echo '
';
### Get all uri segment after another segment
echo $path->after('apple', null); // banana/melon/orange.html
echo '
';
### Get an uri segment after another segment, before certain token
echo $path->after('melon', 1, '.?&'); // orange
exit;
?>
Note that one or more empty uri segment will be skipped, e.g. `apple//banana`, `$path->after('apple')` will return banana.