use Illuminate\Http\Request; $request = Request::create('/foo?bar=baz', 'GET'); $uri = $request->getUri(); // Output: "http://localhost/foo?bar=baz" echo $uri;
use Illuminate\Http\Request; $request = Request::capture(); $uri = $request->getUri(); // Output: "https://example.com/foo/bar" echo $uri;In this example, we capture the current request using the static `capture` method. This will create a `Request` object representing the current HTTP request. We then call the `getUri` method to retrieve the full URI of the request. Package library: `illuminate/http` (part of the Laravel framework)