ItSolutionStuff.com

How to Get Path in Laravel Application Root?

By Hardik Savani β€’ November 5, 2023
Laravel

Hello Artisan,

Now, let's see a tutorial of how to get path in laravel. This article goes in detailed on how to get public path in laravel. let’s discuss about how to get base path in laravel. I would like to show you how to get storage folder path in laravel. Alright, let’s dive into the details.

Laravel provide several helper to get path of public directory, app directory, storage directory and base directory. It will help to store files, read file from path and also for other from controller, view files, model etc.

You can see as bellow how to get path of that directory using helper one by one.


How to Get Public Folder Path in Laravel?

public_path(); // /var/www/example-app/public


How to Get Base Path(Project Root) in Laravel?

base_path(); // /var/www/example-app


How to Get Storage Folder Path in Laravel?

storage_path(); // /var/www/example-app/storage


How to Get App Folder Path in Laravel?

app_path(); // /var/www/example-app/app

I hope it can help you...

Tags: Laravel
Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

πŸ“Ί Subscribe on YouTube

We Are Recommending You

β˜…

How to Create Zip File and Download in Laravel 10?

Read Now β†’
β˜…

How to Send Email using Gmail in Laravel 10?

Read Now β†’
β˜…

Laravel Collection map() Add Attribute Example

Read Now β†’
β˜…

How to Automatically Generate Sitemap in Laravel?

Read Now β†’
β˜…

Laravel Send Scheduled Emails Tutorial

Read Now β†’
β˜…

How to Generate QR Code in Laravel?

Read Now β†’
β˜…

Laravel Group By with Max Value Query Example

Read Now β†’
β˜…

Laravel Add Custom Configuration File Example

Read Now β†’
β˜…

Laravel Collection Sum Column Example

Read Now β†’
β˜…

Laravel Signature Pad Example Tutorial

Read Now β†’
β˜…

Laravel Livewire Pagination Example

Read Now β†’
β˜…

How to Get File Extension from Path in Laravel?

Read Now β†’
β˜…

Laravel Eloquent Where Like Query Example Tutorial

Read Now β†’