Join WhatsApp ChannelJoin Now

Laravel 8 Get HTTP Hostname

This post was last updated on December 2nd, 2021 at 01:32 am

Hi Dev,

Today, i we will show you laravel 8 get HTTP hostname. This article will give you simple example of laravel 8 get HTTP hostname. you will laravel 8 get HTTP hostname. In this article, we will implement a laravel 8 get HTTP hostname. get http host name from request object and helper that way you can easily get domain name or sub domain name too. request provide two methods to get hostname as getHttpHost() and getHost().

So let’s follow few step to create example of laravel 8 get HTTP hostname.

Example: 1

$host = request()->getHttpHost();

Example: 2

$host = request()->getHost();

Example: 3

public function yourControllerFun(Request $request) {

    $host = $request->getHttpHost();



    dd($host);

}

I hope it will assist you…

Recommended Posts