$request = Request::createFromGlobals(); $path = $request->getPathInfo(); echo "Path: " . $path;
if ($_SERVER['REQUEST_URI'] == '/about-us') { $content = 'This is the About Us page.'; } elseif ($_SERVER['REQUEST_URI'] == '/contact-us') { $content = 'This is the Contact Us page.'; } else { $content = 'Welcome to our website!'; }In this example, we use the $_SERVER['REQUEST_URI'] superglobal to retrieve the path of the current request. We then use an if/else statement to determine what content to display based on the path. The package/library used in these examples is likely Symfony's HttpFoundation component, which provides an object-oriented layer for the HTTP specification in PHP.