DEV Community

Cover image for How to Get Current Full URL in Laravel 11
Saddam Hossain
Saddam Hossain

Posted on

How to Get Current Full URL in Laravel 11

In this short article, I will show you how to get current full url in laravel 11 application. Laravel 11 provides several methods to get the current URL. You Can Learn Laravel 11 Generate and Read Sitemap XML File Tutorial
We will use the URL facade, url() helper, Route facade, and Request facade to get the current URL. So, let’s see one-by-one example below:

Lets Start How to Get Current Full URL in Laravel 11

Get Current URL in Laravel:

Example 1: current() with Helper

we can use current() function with url() helper to get current url:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class UserController extends Controller
{
    /**
    * @return \Illuminate\Support\Collection
    */
    public function index(Request $request)
    {
        $currentURL = url()->current();

        dd($currentURL);
    }
}
Enter fullscreen mode Exit fullscreen mode

Example 2: full() with Helper(with query string parameters)

we can use full() function with url() helper to get current full url with query string parameters:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class UserController extends Controller
{
    /**
    * @return \Illuminate\Support\Collection
    */
    public function index(Request $request)
    {
        $currentURL = url()->full();

        dd($currentURL);
    }
}
Enter fullscreen mode Exit fullscreen mode

Read More

Image of AssemblyAI tool

Transforming Interviews into Publishable Stories with AssemblyAI

Insightview is a modern web application that streamlines the interview workflow for journalists. By leveraging AssemblyAI's LeMUR and Universal-2 technology, it transforms raw interview recordings into structured, actionable content, dramatically reducing the time from recording to publication.

Key Features:
🎥 Audio/video file upload with real-time preview
🗣️ Advanced transcription with speaker identification
⭐ Automatic highlight extraction of key moments
✍️ AI-powered article draft generation
📤 Export interview's subtitles in VTT format

Read full post

Top comments (0)

Cloudinary image

Optimize, customize, deliver, manage and analyze your images.

Remove background in all your web images at the same time, use outpainting to expand images with matching content, remove objects via open-set object detection and fill, recolor, crop, resize... Discover these and hundreds more ways to manage your web images and videos on a scale.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay