1. Go to this page and download the library: Download zeroframe/zerorouter library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
zeroframe / zerorouter example snippets
ter = new \Zeroframe\Zerorouter\Router(
(new \Zeroframe\Zerorouter\RouterMap(
function (\Zeroframe\Zerorouter\RouterMap $routerMap) {
$routerMap->all('/');
$routerMap->all('/{user}');
$routerMap->all('/dummy/{bookmarks}');
$routerMap->all('/{page}/category');
},
// enable cache only in production
false,
// cache file path
''
// here you can add strategy, the order gives the priority and you are free to remove or add new strategies
))->addStrategy(new \Zeroframe\Zerorouter\Lookups\HeaderKeyLookupStrategy())
->addStrategy(new \Zeroframe\Zerorouter\Lookups\StaticKeyLookupStrategy())
->addStrategy(new \Zeroframe\Zerorouter\Lookups\PrefixBlockLookupStrategy())
->addStrategy(new \Zeroframe\Zerorouter\Lookups\SuffixBlockLookupStrategy())
->addStrategy(new \Zeroframe\Zerorouter\Lookups\GenericBlockRegexLookupStrategy())
);
$psr17 = new \Nyholm\Psr7\Factory\Psr17Factory();
$request = (new \Nyholm\Psr7Server\ServerRequestCreator(
$psr17,
$psr17,
$psr17,
$psr17
))->fromGlobals();
var_dump($router->dispatch($request));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.