match('GET', '/packages')) { $tags = explode(';', (string)$request->getQueryParam('tags', FILTER_SANITIZE_STRING)); $packages = empty($tags) ? Patchouli::getPackages() : Patchouli::getPackagesWithTags($tags); echo FWIF::encode($packages); return; } if($request->match('GET', '/')) { header('Content-Type: text/html; charset=utf-8'); echo 'Patchouli
';
    readfile(PAT_ROOT . '/patchouli.txt');
    echo '
'; return; } // REGEX MATCHES ↓ if($request->match('GET', '#^/packages/([a-z0-9-]+)/?$#', $args)) { try { $packageInfo = Patchouli::getPackage($args[0]); } catch(PackageNotFoundException $ex) { http_response_code(404); $packageInfo = new ErrorResponse(404, 'Package not found.'); } echo FWIF::encode($packageInfo); return; } echo FWIF::encode(new ErrorResponse(404, 'Path not found.'));