How to get Laravel Application root path ?

Hello,
Have a nice day. Today i am sharing with you, how can you get application root path, storage path in Laravel 5,6,7,8 & 9.

Laravel provide several helper to retrive app path, public path, storage path and base path. Let's see how to access this path.

 

How to get public path

public_path()
//you can access public folder via this helper

How to get Storage path

storage_path()
//you can access storage folder via this helper method.

How to get App path

app_path()
//you can access app folder using this helper.

How to get Base path

base_path()

//you can access root of the application using this helper. You can travel any of the folder using this folder.

 

Hope, it will help you.

Related Post