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 get random rows in laravel example

How to get random rows in laravel example ?

October 10, 2022March 16, 2024

In this blog post, we’ll take a look at how to get random rows in Laravel database. We’ll explore the use of the QueryBuilder, Eloquent, and the DB facade. laravel has inbuilt eloquent method to get the random records from database using the inRandomOrder method. we will understand the random…

Read More
Php How to Call an External Url API in Laravel

How to Call an External Url API in Laravel ?

June 5, 2022June 5, 2022

In this article we will learn to call an external Url API in Laravel. Whenever we want to access the third party data we need to access the data using the APIs, we send a request to another server means outside our application and they respond with preformatted structure. In…

Read More

Enabling and Disabling Debug Mode in Laravel: A Step-by-Step Guide

July 6, 2023March 16, 2024

Debug mode is a useful feature in Laravel that provides detailed error messages and stack traces during development. However, it’s essential to disable debug mode in production to ensure the security of your application. In this blog post, we will walk you through the steps to enable and disable debug…

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

  • July 2025
  • 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

  • Mapping Together: The Vibrant Spirit of OpenStreetMap Japan
  • Understanding High Vulnerabilities: A Deep Dive into the Weekly Summary
  • Building a Million-Dollar Brand: The Journey of Justin Jackson
  • Mastering Schedule Management with Laravel Zap
  • The Resilience of Nature: How Forests Recover After Fires
©2023 Readerstacks | Design and Developed by Readerstacks
Go to mobile version