Skip to content
Readerstacks logo Readerstacks
  • Home
  • Softwares
  • Angular
  • Php
  • Laravel
  • Flutter
Readerstacks logo
Readerstacks
How to get laravel application root path

How to get laravel application root path ?

Aman Jain, October 13, 2022March 16, 2024

In this blog post, we’ve shown you how to get laravel application root path directory. If you need to get the path from anywhere in your application, you can use the Laravel public_path() helper function. If you need to get the path to your application’s storage directory, you can use the storage_path() helper function. These are just a few of the ways you can get the path to your Laravel application’s root directory.

Get laravel application root path using base_path

Laravel has helpers to get the path of root folder, public folder, assets folder, storage folder, app folder.

To get the path of root application folder we can use base_path() function in laravel which gives the path of root folder in laravel project.

base_path();
//we can pass parameters to base_path function

base_path("app/Http/Controllers");

Output will be:

var/www/html/app/Http/Controllers

To get the path of storage folder in laravel we can user storage_path() function which gives path of storage folder.

storage_path();
//we can pass parameters to storage_path() function

storage_path("app");

Output will be:

var/www/html/storage/app

To get the path of app folder in laravel we can user app_path() function which gives path of app folder.

app_path();
//we can pass parameters to base_path() function

app_path("controllers");

Output will be:

var/www/html/app/controllers

To get the path of public folder in laravel we can user public_path() function which gives path of public folder.

public_path();
//we can pass parameters to public_path() function

public_path("images");

Output will be:

var/www/html/public/images

Read more about the helpers to get the access of directories in How to get folder paths using helpers in laravel?

Related

Laravel base_pathdirectoryhelperslaravel

Post navigation

Previous post
Next post

Related Posts

Php How to Use hasOne Relationship in Laravel

How to Use hasOne Relationship in Laravel with Example ?

February 27, 2022October 4, 2022

hasOne relationship in laravel is used to create the relation between two tables. hasOne means create the relation one to one. For example if a article has comments and we wanted to get one comment with the article details then we can use hasOne relationship or a user can have…

Read More
Php Integrate Google Map with Marker in Laravel

Integrate Google Map with Marker in Laravel

August 28, 2022March 16, 2024

In this article we will learn to integrate google map with marker in laravel. Google maps are used to share the location or indicate the location of business and any user. In our application we want to show the exact location so in that case google maps are most optimal…

Read More
Laravel folder paths using helpers in laravel

How to get folder paths using helpers in laravel?

August 27, 2021February 22, 2024

Laravel has helpers to get folder paths using helpers in laravel and by which we can easily get root folder, public folder, assets folder, storage folder, app folder etc. Laravel has helpers to get the path of root folder, public folder, assets folder, storage folder, app folder. To get the…

Read More

Aman Jain
Aman Jain

With years of hands-on experience in the realm of web and mobile development, they have honed their skills in various technologies, including Laravel, PHP CodeIgniter, mobile app development, web app development, Flutter, React, JavaScript, Angular, Devops and so much more. Their proficiency extends to building robust REST APIs, AWS Code scaling, and optimization, ensuring that your applications run seamlessly on the cloud.

Categories

  • Angular
  • CSS
  • Dart
  • Devops
  • Flutter
  • HTML
  • Javascript
  • jQuery
  • Laravel
  • Laravel 10
  • Laravel 11
  • Laravel 9
  • Mysql
  • Php
  • Softwares
  • Ubuntu
  • Uncategorized

Archives

  • June 2025
  • May 2025
  • April 2025
  • October 2024
  • July 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • July 2023
  • March 2023
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

Recent Posts

  • The Resilience of Nature: How Forests Recover After Fires
  • Understanding Laravel Cookie Consent for GDPR Compliance
  • Understanding High Vulnerabilities: A Critical Overview of the Week of May 12, 2025
  • Installing a LAMP Stack on Ubuntu: A Comprehensive Guide
  • Understanding High Vulnerabilities: A Deep Dive into Recent Security Concerns
©2023 Readerstacks | Design and Developed by Readerstacks
Go to mobile version